Shyam Singh
Shyam Singh

Reputation: 123

mod_rewrite RewriteRule in .htaccess is not working

I'm facing a strange issue with mod_rewrite RewriteRule in .htaccess.

Here's my minimal .htaccess file:

RewriteEngine On
RewriteRule ^phpinfo phpinfo.php [L]

The above Rewrite results in 404 Not Found. However, suffixing anything to ^phpinfo works which is unintended and undesired.

RewriteEngine On
RewriteRule ^phpinfophp phpinfo.php [L]

Please help me with making the actual RewriteRule work.

Thanks,

Shyam Singh

Upvotes: 0

Views: 30

Answers (1)

C3roe
C3roe

Reputation: 96454

RewriteRule ^phpinfo phpinfo.php [L]

MultiViews often causes problems in instances likes this, because its job is to detected slightly misspelled URLs, multiple possible file matches (different extensions, etc.) and correct them – and it interferes here, because it sees a request for phpinfo and finds a corresponding file phpinfo.php

Deactivate it using Options -MultiViews, that should fix the problem.

Upvotes: 1

Related Questions