htaccess 将一个文件重定向到另一个文件

2023-11-21

我读了this这对于我的要求来说似乎太长了。

并尝试过Redirect /index.php /index2.php但它不起作用(内部服务器错误)

我想要的是将我的一些 php 文件重定向到 index.html。例如,我的索引文件为

header.php

内容.php

页脚.php

我想将对这些文件的直接访问重定向到index.php。可以用 htaccess 或者其他方式吗?

mysite.com/index.php 好的 mysite.com/header.php 重定向到 404 或索引或其他内容。


Try:

RewriteEngine On
RewriteRule ^(header|content|footer)\.php - [L,R=404]

or

RewriteEngine On
RewriteRule ^(header|content|footer)\.php index.php [L,R=301]
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

htaccess 将一个文件重定向到另一个文件 的相关文章

随机推荐