简体   繁体   中英

URL Rewriting and GET values

I know there are lots of answer about this, but I can't understand why it does not work for me.

I want every URL like :

http://mywebsite.com/campagne/blabla

to be redirected to

http://mywebsite.com/campagne.php?c=blabla

Here is my .htaccess file:

Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteRule campagne/(.+)$  campagne.php?c=$1 [QSA,L]   [L]

The URL is redirected to campagne.php but $_GET['c'] is not sent.

Can you help me? I cannot find what is wrong? It works on my local server but not online.

This is due to enabling of MultiViews option in your Apache. Place this line on top of your .htaccess to turn it off:

Options -MultiViews

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM