Rewrite Uses New URL instead of the Old One

New to mod_rewrite? This is a good place to start.

Rewrite Uses New URL instead of the Old One

Postby ZoomZoom » Fri Nov 22, 2002 1:16 am

Like a lot of people on this site, I would like to rewrite my url so that it appears like this /members/username as opposed to /members/index.php?screenName=username.

I think I got the idea of how it's supposed to work, but I just can't get it. I have added the following to my .htaccess file:

RewriteEngine on
RewriteRule ^members/(.*) members/index.php?screenName=$1 [L]

Unfortunately, when i type www.mydomain.com/members/username this sets screenName to index.php -- not username! It appears that it's processing the url change before assigning the variable.

If I created a subdirectory called members/users/ and set my url to redirect to that, I get screenName set to users/index.php.

What am I doing wrong? Help!
ZoomZoom
 

Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 6 guests

cron