使用mod_rewrite通过Codeigniter重定向旧URL
我正在使用codeigniter框架重新开发一个网站 当我们上线时,我们希望确保将一些旧URL重定向到新站点上的相应页面 因此,我将我认为正确的规则放在现有的htaccess文件中,高于CodeIgniter应用的其他规则 然而,它们没有发挥作用。有人能告诉我我遗漏了什么吗使用mod_rewrite通过Codeigniter重定向旧URL,codeigniter,mod-rewrite,url-rewriting,Codeigniter,Mod Rewrite,Url Rewriting,我正在使用codeigniter框架重新开发一个网站 当我们上线时,我们希望确保将一些旧URL重定向到新站点上的相应页面 因此,我将我认为正确的规则放在现有的htaccess文件中,高于CodeIgniter应用的其他规则 然而,它们没有发挥作用。有人能告诉我我遗漏了什么吗 # pickup links pointing to the old site structure RewriteRule ^(faq|contact)\.php$ /info/ [R=301] RewriteRule ^r
# pickup links pointing to the old site structure
RewriteRule ^(faq|contact)\.php$ /info/ [R=301]
RewriteRule ^registration\.php$ /register/ [R=301]
RewriteRule ^update_details\.php$ /change/ [R=301]
# Removes access to the system folder by users.
RewriteCond %{REQUEST_URI} ^_system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
# This snippet prevents user access to the application folder
# Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^myapp.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
# This snippet re-routes everything through index.php, unless
# it's being sent to resources
RewriteCond $1 !^(index\.php|resources)
RewriteRule ^(.*)$ index.php/$1
尝试将[L]ast标志添加到R=301标志=>[L,R=301],以确保没有应用其他规则,并且,为了确保,尝试重定向到完整的URL,为了更确保没有删除任何内容,请将RewriteEngine添加到顶部并设置RewriteBase 让你的第一排看起来像
RewriteEngine On
RewriteBase /
RewriteRule ^(faq|contact)\.php$ http://www.YOURDOMAIN.XYZ/info/ [L,R=301]
并检查当您调用faq页面时,浏览器中的URL是否更改