homepage Welcome to WebmasterWorld Guest from 54.227.67.210
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Mod rewrite doesn't work with parameter(s)
iProgram




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

#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]

 

Achernar




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

It works for me. (tested on my server)

iProgram




msg:3579565
 2:11 am on Feb 20, 2008 (gmt 0)

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved