PDA

View Full Version : mod_rewrite not working?



bcarlisle
08-18-2007, 08:59 AM
I would like to use mod_rewrite to rewrite urls for an application that resides on a subdomain of mine. The application is driven by index.php, which expects two parameters: class and action (no it's not a legal website silly). I would like the URL http://subdom.example.com/Users/list to be redirected to : http://subdom.example.com?class=Users&action=list behind the scenes.

I have the following contained in my /home/user/public_html/subdom/.htaccess



RewriteEngine On

# Redirect to the homepage
RewriteRule ^/$ /index.php?class=welcome [L,QSA]

# Changes /index.php?class=welcome to /welcome
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule ^/([^/]*)$ /index.php?class=$1 [L,QSA]

# Changes /index.php?class=users&action=login to /users/login
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule ^/([^/]*)/([^/]*)$ /index.php?class=$1&action=$2 [L,QSA]

This has worked on other servers pretty well (using an apache virtualhost). Any ideas why it isn't working on my subdomain?

Thanks in advance for the help!