【发布时间】:2015-01-22 16:15:24
【问题描述】:
我最近启动了一个 codeigniter 网站,需要进行一些从旧网站到新网站的 301 重定向。它们不适用于正则表达式,因此,由于只有少数,我可以为每个页面编写重定向。然而,经过数小时的谷歌搜索/纠正,我仍然没有快乐。旧站点的 URL 是 .html 文件,而我的 codeigniter URL 是“干净”的 URL。这是我当前的 .htaccess 文件:
<IfModule mod_alias.c>
redirect 301 "/index.html" /index.php
</IfModule>
<IfModule mod_rewrite.c>
DirectoryIndex index.php
RewriteEngine on
#This is the redirect I've been trying to make work
RewriteRule ^/about-us.html /index.php?/about-us [R=301,L]
RewriteCond $1 !^(index\.php|index\.html|lib|robots\.txt)
RewriteRule ^(.*)$ index.php?/$1
</IfModule>
有什么想法吗?
【问题讨论】:
标签: php .htaccess codeigniter redirect http-status-code-301