pistou
pistou

Reputation: 2867

URL Rewrite not working on directory

I'm trying to set up a URL Rewrite for my website, hosted on 1&1.

Here is my .htaccess on root directory ( ./ )

AddHandler x-mapp-php6 .html .htm
Options +FollowSymlinks
RewriteEngine On

RewriteRule ^404$ /404.html [L]
ErrorDocument 404 /404

RewriteRule ^login$ /login.html [L]
RewriteRule ^register$ /register.html [L]
RewriteRule ^contact$ /contact.html [L]

RewriteRule ^admin$ /admin.html [L]
RewriteRule ^admin/user$ /administration/user.html [L]
RewriteRule ^admin/user/p/([0-9]+)$ /administration/user.html?p=$1 [L]

There is something strange with it :

Even if I change the order or if I delete the line RewriteRule ^admin$ /admin.html [L] and I try to go to website.com/admin or website.com/admin/user I still have the same page (/admin.html) like if the url rewrite was in cache or something.

Anyone has a clue?

Upvotes: 1

Views: 313

Answers (1)

anubhava
anubhava

Reputation: 785146

This is most likely due to enabling of MultiViews on your Apache host. Disable it by using this line on top of your .htaccess:

Options -MultiViews
  • Option MultiViews is used by Apache's content negotiation module that runs before mod_rewrite and and makes Apache server match extensions of files. So /file can be in URL but it will serve /file.php.

Upvotes: 1

Related Questions