Hi, thanks for looking at this post.

I have searched and experimented and after hours of getting really close I have finally admitted to my self that I'm going to have to stop and ask directions!

So, I want the browser address http://drivingmeinsane/Join to be re-written to http://drivingmeinsane/?page=Join

I've come really close ... here's my best effort:

Options +FollowSymlinks
RewriteEngine on
RewriteBase /
RewriteRule ^(Join|Sponsor|Contact)/?$ ?page=$1

Two problems:

1) (Join Us|Sponsor Us|Contact Us) does not work.
2) I don't really want to list all of the possible variables because it will be a dynamic list that can change.

I have tried replacing (Join Us|Sponsor Us|Contact Us) with all sorts, for example (.*) but to no avail.

Can anyone help please?

Thanks,

Simon.

almostbob commented: Does the heart good, to see somebody do the work and then ask for help, instead of just ask do it for me +12

I think the rule would look like this... RewriteRule ^(.+)$ index.php?page=$1 [NC,L]

Thanks JorgeM ... this was so close! If I use your code the index.php page does return but the $_GET['page'] variable returns 'index.php' and the link for the CSS file referenced in the page head fails to load ... getting closer all the time though! thanks for your help.

I built a demo on a php site to test this further... I used the following in my .htaccess file. added the QSA flag as well.

.htaccess
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteRule ^(.+)? index.php?page=$1 [NC,L,QSA]

If I type this.. http://mydomain.com/test, then then index.php page comes up and I successfully wrote back "test" by accessing it using GET. here is my php code i used..

index.php
<?php
echo ("You reached index.php");
echo ("<br/>");
echo ("Parameter passed: " .$_GET['page']);
?>

JorgeM, thank you so much for your help with this ... I will try out this code first thing tomorrow.

cheers,

Simon.

Shold be like this
RewriteRule ^(.*)$index.php?id=$1

JorgeM ... well that worked! thank you so much.

ellana980 ... that's what I thought it should be but it didn't work.

Thank you both of you.

Simon.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.