【发布时间】:2012-05-19 06:09:09
【问题描述】:
我正在尝试将 URL 从 index.php 转换为 index.html,servicii.php 转换为 servicii.html 等等。
我在我的.htaccess 文件中写了以下代码:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)\.php$ $1.html [R=permanent]
</IfModule>
?>
但是当我关注“Prima pagina”(主页)或“Servicii”(在网站上创建的仅有的 2 个页面)时,它给了我一个 404 错误
另外,我有代码
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /fetesti/
RewriteRule ^(.*)\.php$ $1.html [R=permanent]
</IfModule>
在基于 XAMPP 的本地计算机上。它给了我找不到对象 404,并在我的 Apache 日志中:
找不到文件 [...]/index.html;
我知道重写引擎正在工作(我写了乱码,它给了我 505 内部服务器错误并进行了其他测试)
我做错了什么?
【问题讨论】:
-
您能否将您的代码格式化为代码块,以便我们轻松阅读?它有很大帮助。谢谢
标签: mod-rewrite http-status-code-404