orugari
orugari

Reputation: 426

url rewrite working on local but not on server

RewriteEngine on
Options +FollowSymlinks    

RewriteRule ^index\.html$  index.php [L]

RewriteRule ^gallery/([0-9]+)/([a-zA-Z0-9-_]+)/$   gallery.php?pid=$1&urln=$2 [L]

On localhost pid=$1 is working perfectly fine but on server (OVH) I get an empty value. The url is working fine, I reach gallery.php

Thanks for your help !

Upvotes: 2

Views: 138

Answers (1)

anubhava
anubhava

Reputation: 784958

Most likely your server has MultiViews option enabled. Option MultiViews is used by Apache's content negotiation module that runs before mod_rewrite and makes Apache server match extensions of files. So /file can be in URL but it will serve /file.php.

Try this:

Options +FollowSymlinks -MultiViews   
RewriteEngine on

RewriteRule ^index\.html$ index.php [L,NC]

RewriteRule ^gallery/([0-9]+)/([\w-]+)/$ gallery.php?pid=$1&urln=$2 [L,QSA]

Upvotes: 1

Related Questions