views:

139

answers:

1
+1  Q: 

Mod rewrite issue

Hello,

As many others I am having issues with doing some very simple mod_rewriting in apache.

I have the following in my .htaccess:

Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteRule ^view/([0-9]+)/([0-9]+)$ view.php?advertId=$1&publisherId=$2 [NC,QSA,L]

Which is supposed to translate /view/4093/203?qs=val -> /view.php?advertId=4093&publisherId=203?qs=val

Now, it works when calling it with /View..., but when doing lowercase /view, it redirects to the right file, but advertId and publisherId is not set within my PHP script as it is with the first-letter-uppercase View and I simply put have no clue whatsoever with what is going on on that front (I have been testing and watching that behavior simply by doing a on my view.php).

Anyone know why this is happening?

I may want to add, my server info is as follows:

Apache/2.2.9 (Debian) PHP/5.2.6-1+lenny2 with Suhosin-Patch mod_python/3.3.1 Python/2.5.2 mod_perl/2.0.4 Perl/v5.10.0

IE. a stock brand new debian install with default debian packages + php-mssql.

+2  A: 

MultiViews might cause this behavior, that is trying to map the request to a siminar existing file before passing the request to mod_rewrite. Try to disable it:

Options -MultiViews
Gumbo
Bloody brilliant! Can I ask how and why though?
kastermester
`MultiViews` is a Core feature that’s being executed before mod_rewrite. When `MultiViews` is enabled, Apache is trying to find a similar filename to that the request path can be mapped. So your `/view/…` is mapped to `/view.php/…` and then passed to mod_rewrite, that then cannot find a match.
Gumbo
Ah ok, well thanks a ton for the help, took me alot of effort trying to mess around with the rewriting, which obviously didn't help anything at all - your help is much appreciated! :)
kastermester
Is there a possibility to tell MultiViews to use the output of mod_rewrite? I'd really like to use mod_negotiation's power without lots of RewriteCond statements that do basically the same.
Boldewyn