James
James

Reputation: 478

Mod_rewrite will accept one string but not another

Can somebody please tell me what's going on...

RewriteEngine on

RewriteRule ^contacto/?$ index.php?seccion=contacto [L]
RewriteRule ^contactar/?$ index.php?seccion=contacto [L]

I want "contacto" to take me to "index.php?seccion=contacto", but it just takes me to "contacto.php" ignoring my rule completely. The funny thing is that if I change the string "contacto" to something else like in the second line, it works, taking me to "index.php?seccion=contacto"

There are no other .htaccess on the root or any subfolders. I have a fresh copy of Wamp (latest version) with Apache 2.4 and Php 7.2

Any ideas?

Upvotes: 0

Views: 18

Answers (1)

Capsule
Capsule

Reputation: 6159

You must have the MultiViews option enabled on your Apache setup. Add Options -MultiViews at the top of your .htaccess file to disable it.

MultiViews doesn't play well with rewrite rules because it tries to translate URI like 'contact' into 'contact.en.php' or 'contact.fr.php' depending on the accept-language headers sent in the request.

Upvotes: 1

Related Questions