我只是将我的网站从 asp 迁移到 opencart。在 .htaccess 中,我想做一些重定向,以便我的客户可以使用旧链接进行访问
在.htaccess里面
redirect 301 /contact.asp http://www.example.com/index.php?route=information/contact_us
redirect 301 /downloads.asp http://www.example.com/downloads
但是,对于完美运行的“联系我们”,对于下载 url,它无法正常运行。当我访问http://www.example.com/downloads.asp
它时,它将重定向到http://www.example.com/downloads?_route_=downloads.asp
Opencart 并显示它是找不到页面。对于http://www.example.com/downloads
我们在后端系统中设置了 SEO 友好的 URL。
我们能够访问
http://www.example.com/information/downloads
http://www.example.com/downloads
但我们无法通过正常链接访问
http://www.example.com/index.php?route=information/downloads
以下是我的完整 .htaccess
# Prevent Direct Access to files
<FilesMatch "\.(tpl|ini)">
Order deny,allow
Deny from all
</FilesMatch>
# SEO URL Settings
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
redirect 301 /contact.asp http://www.example.com/index.php?route=information/contact_us
redirect 301 /downloads.asp http://www.example.com/downloads
============另一个测试=========================
我在本地主机上对此进行了一些测试,我发现这是一个非常有趣的结果。但是,我的问题仍然没有解决。
我从http://localhost/example和http://example运行 .htaccess (添加了虚拟目录)
redirect 301 /example/downloads.asp http://localhost/example/downloads/
和
redirect 301 /downloads.asp http://example/downloads/
然后我尝试从本地主机(http://example)重定向到我的实时版本链接
redirect 301 /downloads.asp http://www.example.com/downloads/
我访问http://example/downloads.asp
浏览器重定向到我
http://www.example.com/downloads?路线=下载.asp
著名的
在 LIVE 版本中,我没有添加任何重定向代码[对此非常确定]
但在 Live 版本中,我是直接使用 enter 访问
http://www.example.com/downloads
我不确定为什么从 localhost 重定向 301 到 live 版本会出来
http://www.example.com/downloads?路线=下载.asp
任何的想法?