我只是将我的站点从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对于我们的联系,完美的工作,然而,下载网址,它没有正确的工作。当我访问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============ANOTHER TESTING========================
我在本地主机上做了一些测试,发现这是一个有趣的退出结果。但是,我的问题还没有解决。
我运行.htaccess从http://localhost/example和http://example (添加虚拟目录)
redirect 301 /example/downloads.asp http://localhost/example/downloads/和
redirect 301 /downloads.asp http://example/downloads/然后,我尝试从localhost (http://example)重定向到我的实时版本链接。
redirect 301 /downloads.asp http://www.example.com/downloads/我可以访问http://example/downloads.asp
浏览器重定向给我
http://www.example.com/downloads?=downloads.asp
注意到
在实时版本中,我没有为这个添加任何重定向代码。
但在Live中,我将直接用enter访问
http://www.example.com/downloads
我不知道为什么会从localhost重定向301到live。
http://www.example.com/downloads?=downloads.asp
有什么想法吗?
发布于 2012-10-02 22:12:55
找到解决方案:.htaccess重定向301使用opencart v1.5.4.1
需要额外的代码..。(和这个修正的学分):https://github.com/opencart/opencart/pull/142 .替换目录/控制器/通用/seo_url.php- system/library/url.php的内容
重定向精细: http:....com/index.php?route=information/contact RewriteRule contacto R=301,L
重定向不工作:重定向301联系人http:....com/index.php?route=information/contact
已经确认了。
发布于 2011-04-08 01:49:51
把它放在路由器前面。在前面加上$在.asp和^之后。
# Prevent Direct Access to files
<FilesMatch "\.(tpl|ini)">
Order deny,allow
Deny from all
</FilesMatch>
# SEO URL Settings
RewriteEngine On
redirect 301 ^contact.asp$ http://www.example.com/index.php?route=information/contact_us
redirect 301 ^downloads.asp$ http://www.example.com/downloads
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]为什么不将联系人重定向到/information/contact_us而不是index.php?route=information/contact_us呢?
发布于 2013-09-20 11:31:42
如果重定向url不像2 url那样存在,您可以在重定向url的末尾尝试"?" (它对我有用):
redirect 301 /contact.asp http://www.example.com/index.php?route=information/contact_us
redirect 301 /downloads.asp http://www.example.com/downloads?https://stackoverflow.com/questions/5589582
复制相似问题