【发布时间】:2017-08-27 15:33:02
【问题描述】:
我正在使用这个 .htaccess 在我的 URL 中删除 .php
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
我的文件结构是这样的:
css/
es/
-- contact.php
-- index.html
js/
contact.php
index.php
我要在我的主 index.php 中创建一个链接,如下所示:
<a href="es/">Español</a>
但是当我尝试访问它时,我的服务器返回 404 错误。当我删除 .htaccess 时,这个链接可以正常工作,所以我想我需要 .htaccess 中的其他内容。谁能指导我我必须添加什么才能使它起作用?
【问题讨论】:
标签: php apache .htaccess mod-rewrite