Machou
Machou

Reputation: 171

RewriteRule didn't rewrite correct URI

This is my .htaccess :

AddDefaultCharset UTF-8
DefaultLanguage fr-FR

Options -Indexes

RewriteEngine on
RewriteBase /

<Files .htaccess>
    Order Allow,Deny
    Deny from all
</Files>

RewriteRule ^cle-usb-populaires/$ /top-cle-usb.php [QSA]
RewriteRule ^informatique/$ /informatique.php [QSA]
RewriteRule ^cles-usb/$ /informatique.php?groupe=usb [QSA]

This Rewrite Work :

RewriteRule ^top-usbb-key/$ /top-usb-key.php [QSA]

This Rewrite DON'T Work

RewriteRule ^informatique/$ /informatique.php [QSA]

This Rewrite Work

RewriteRule ^cles-usb/$ /informatique.php?groupe=usb [QSA]

So i don't understand why the 1st & 3rd Rewrite work, not the 2nd ... :(

Any idea ?

Upvotes: 1

Views: 59

Answers (1)

anubhava
anubhava

Reputation: 785256

This Rewrite Work

RewriteRule ^cle-usb-populaires/$ /top-cle-usb.php [QSA]

This Rewrite DON'T Work

RewriteRule ^informatique/$ /informatique.php [QSA]

It is most likely due to option MultiViews turned on.

Turn it off using this line at top of your .htaccess:

Options -MultiViews

Option MultiViews (see http://httpd.apache.org/docs/2.4/content-negotiation.html) is used by Apache's content negotiation module that runs before mod_rewrite and makes Apache server match extensions of files. So if /file is the URL then Apache will serve /file.html.

Upvotes: 1

Related Questions