Forum Moderators: phranque

Message Too Old, No Replies

Rewrite Not work

         

khiemnd

6:15 pm on Dec 28, 2007 (gmt 0)

10+ Year Member



I want to rewrite url by some rule but It didn't work, please help me to resolve it.

Where can I find some document about it?

Thanks.

RewriteEngine On

# Change the URI here to whatever you want your homepage to be
RewriteRule ^/$ /index.php?module=welcome [L,QSA]

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

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

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

jdMorgan

9:45 pm on Dec 28, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How, specifically, does this code not work?
What URLs did you request to test it?
What was the result?
How did the result differ from your expectations?
Do you have any other working rewrite rules on this server?
Where is the code above located -- /httpd.conf? /.htaccess?

I would point out that the comments in this code are inaccurate, and the code itself contains several CPU-wasting inefficiencies. But without knowing what your specific problem is, I can't comment further.

Jim