Php 更改.htaccess以删除文件扩展名后,未找到页面错误
我是个新来的人 我试图从php文件中删除扩展名,我将其添加到.htaccess文件中Php 更改.htaccess以删除文件扩展名后,未找到页面错误,php,apache,.htaccess,Php,Apache,.htaccess,我是个新来的人 我试图从php文件中删除扩展名,我将其添加到.htaccess文件中 RewriteEngine on Options All -Indexes RewriteRule ^([^/.]+)/?$ $1.php 这是工作正常,但当我想打开管理员或试图打开任何文件夹,然后它显示 www.mysite.com/admin/ Not Found The requested URL /admin.php was not found on this server. 在我的网站根文件夹中
RewriteEngine on
Options All -Indexes
RewriteRule ^([^/.]+)/?$ $1.php
这是工作正常,但当我想打开管理员或试图打开任何文件夹,然后它显示
www.mysite.com/admin/
Not Found
The requested URL /admin.php was not found on this server.
在我的网站根文件夹中没有任何admin.php页面
帮忙会很感激的
谢谢你能试试这种方法,告诉我它对你有什么作用吗:
Options All -Indexes
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.+)$ $1.php [L]
为什么会发生这样的事……没有人知道??这是真的,伙计:)你能为我解释一下为什么我的代码会导致文件夹出现问题吗???@Dinesh你没有检查文件是否存在,所以你也在重写文件夹名称。非常感谢你