Forum Moderators: phranque

Message Too Old, No Replies

redirect urls: site/username -> site/user.php?username

redirecting users based on url

         

synewaves

3:59 pm on Oct 30, 2004 (gmt 0)



I'd like to set up something in my .htaccess that would accomplish something like the following:

I'd have a url: [site.com...] which I'd like to redirect to: [site.com...]

I can't figure out how to get this working... Mainly because I first have to make sure the request is for a user and not for a sub folder (ie: "http://www.site.com/images" versus "http://www.site.com/username").

I have a list of the folders in the directory that I'd like to exclude and no username will ever match any of these folders.

Also, redirection works a little different on a localhost setup versus the production setup:

[localhost...]
[site.com...]

Any suggestions? I've looked all over and can't find anything that will help me. Thanks in advance!

-Matt

jdMorgan

1:18 am on Oct 31, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Matt,

Welcome to WebmasterWorld!

Do you actually want to redirect the user, or do you want to let them think they've got a "special" subdirectory?
If you redirect them, they'll see the php script URL in their browser address bar. If you simply do an internal rewrite to the script with the proper querystring=useranme, they won't know that the rewrite occurred.

Either way, take a look at our forum charter [webmasterworld.com] for some links to get you started.

The test vs. production server domain is irrelevant if you do an internal rewrite, and can be handled by using the %{HTTP_HOST} variable instead of a fixed domain-name string if you really want to do an external redirect.

Jim