为什么我的301重定向与.htaccess文件无法正常工作?

时间:2014-10-02 13:59:19

标签: apache .htaccess opencart http-status-code-301

我已经安装了SEO Url的Opencart,我已经改变了一些页面的结构,并希望对已更改的页面进行301重定向,因此没有(外部)链接会中断。但是我在opencart中有SEO链接,这意味着一些重写规则被激活,我想这些都会干扰我的301重定向代码。

最后一行是我的重定向。它不会将http://keroproducts.ch/kaufen重定向到http://keroproducts.ch/produkte/,而是会重定向到:http://keroproducts.ch/produkte/?_route_=kaufen,这是不正确的。

这是我的.htaccess文件:

Options +FollowSymlinks

# Prevent Directoy listing 
Options -Indexes

# Prevent Direct Access to files
<FilesMatch "\.(tpl|ini|log)">
 Order deny,allow
 Deny from all
</FilesMatch>

# SEO URL Settings
RewriteEngine On
# If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/ 


RewriteCond %{HTTP_HOST} ^www\.keroproducts\.ch [NC]
RewriteRule ^(.*)$ http://keroproducts.ch/$1 [L,R=301]

RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^download/(.*) /index.php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]


Redirect 301 /kaufen http://keroproducts.ch/

1 个答案:

答案 0 :(得分:1)

这是解决方案:

http://www.itsadam.co.uk/opencart-301-redirect-not-working-seo-fix-route/

你必须添加一个?重定向背后:

Redirect 301 /kaufen http://keroproducts.ch/?
相关问题