简体   繁体   中英

Strange issue with .htaccess file unable to remove PHP extensions

I am on a VPS running Ubuntu 14.04 x64, and I have enabled mod_rewrite .

This works (ie correctly redirects to testfile.php):

RewriteRule ^othername$ testfile.php

But this doesn't (gives me a 404 error, saying "The requested URL /testfile was not found on this server"):

RewriteRule ^testfile$ testfile.php

So I essentially cannot redirect a URL to a file of the same name but with a PHP extension. The two examples are both working locally with MAMP. What could be causing this issue?

正如anubhava所说,你只需要在.htaccess的顶部添加Options -MultiViews

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