mod rewrite question

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
thiscatis
Forum Contributor
Posts: 434
Joined: Thu Jul 20, 2006 11:00 am

mod rewrite question

Post by thiscatis »

Ok, I have mod_rewrite enabled on my server.

I tried to look for some examples but couldn't found somethink like I want.

If someone goes to the URL

http://www.mydomain.com/username/

I want the server to be actually loading
http://www.mydomain.com/users/username/

1. Is this possible with mod_rewrite?
2. What do I have to add to my htaccess file?

Te thing is, I can make something like that if the username is static.
But I need it to be dependent on what the visitors type as URL
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Code: Select all

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [S=1]
RewriteRule ^(.+)/?$ /users/$1 [QSA,L]
Post Reply