1

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.

Votes + Comments
Does the heart good, to see somebody do the work and then ask for help, instead of just ask do it for me
3
Contributors
6
Replies
32
Views
3 Years
Discussion Span
Last Post by slyme
0

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.

0

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']);
?>

Edited by JorgeM

0

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

cheers,

Simon.

0

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.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.