Page 1 of 1

simple mod_rewrite

Posted: Tue Dec 29, 2009 3:52 pm
by invisibled
Hey everybody,

i've been playing with mod_rewrite to try and get a simple rewrite working but i'm missing something, and its not working.

i have a page that is users/?user=somename and i want it to just be /somename

the somename will be dynamic so it can't be hardcoded. Anybody out there done this before? I already have the following rewrite rules on to get rid of the use of .php file extension

Code: Select all

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php

Re: simple mod_rewrite

Posted: Tue Dec 29, 2009 5:30 pm
by requinix
For the extension just use MultiViews. For the somename,

Code: Select all

Options +MultiViews
 
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/?([^/]+)/?$ users/index.php?user=$1 [L]