Welcome to WebmasterWorld Guest from 54.145.208.64

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Mod rewrite doesn't work with parameter(s)

   
2:09 am on Feb 19, 2008 (gmt 0)

10+ Year Member



#My .htaccess file

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^test1/$ test1.php [L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^test2/$ test2.php?page=1 [L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^test3/([0-9]+)/$ test3.php?page=$1 [L]

test1: work
test2: doesn't work, isset($_GET['page']) == FALSE
test3: doesn't work, isset($_GET['page']) == FALSE

What's wrong?

[edited by: iProgram at 2:21 am (utc) on Feb. 19, 2008]

4:48 pm on Feb 19, 2008 (gmt 0)

5+ Year Member



It works for me. (tested on my server)
2:11 am on Feb 20, 2008 (gmt 0)

10+ Year Member



The problem is a result of an Apache option named MultiViews. When the server receives a request for the "test1" directory and there is no such directory, the server is looking for test1.* files and chooses the test1.php file.

As a workaround, I add the following line at the top of .htaccess file:

Options -MultiViews