Magento StoreCode语言标签重定向

时间:2016-12-21 22:44:59

标签: .htaccess magento

我正在尝试将漂亮的语言标记ch-de重定向到Magento商店视图商店代码ch_de

但是它取消了第一个参数并用第二个替换它,它只是在最后添加它。所以它总是看起来像mydomain.com/ch-de/ch_en/,即使在切换器中也让我很困惑。

以下是.htaccess的部分:

SetEnvIf X-Forwarded-Proto https HTTPS=on
############################################
## default index file

    DirectoryIndex index.php


<IfModule mod_rewrite.c>

############################################
## enable rewrites

Options +FollowSymLinks
RewriteEngine on

############################################
## you can put here your magento root folder
## path relative to web root

#RewriteBase /magento/

#############################################
##  redirect all non-www urls to www
##  mod by pagewerkstatt

RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

#############################################
##  add for "base urls" the trailing Slash
##

RewriteRule ^([^.]+[^/])$ /$1/ [R=301,L]


############################################
## uncomment next line to enable light API calls processing

#    RewriteRule ^api/([a-z][0-9a-z_]+)/?$ api.php?type=$1 [QSA,L]

############################################
## rewrite API2 calls to api.php (by now it is REST only)

RewriteRule ^api/rest api.php?type=rest [QSA,L]

SetEnvIf Request_URI "index.php/api/(v2_)?soap/" is_backend=0

RewriteCond %{ENV:REDIRECT_REWRITE_IS_FINISHED} !1
RewriteCond %{REQUEST_URI} !^/[a-z]{2}-[a-z]{2}.*$
RewriteCond %{REQUEST_URI} !^.*/api/.*$
RewriteCond %{REQUEST_URI} !^.*/js/.*$
RewriteCond %{REQUEST_URI} !^.*/skin/.*$
RewriteCond %{REQUEST_URI} !^.*/media/.*$
RewriteCond %{REQUEST_URI} !^.*/adminguru.*$
RewriteRule ^(.*)$ /ch-de/$1 [R,L]

RewriteRule ^ch-de/?(.*) $1 [E=URL_LOCALE:ch-de,E=MAGE_RUN_CODE:ch_de]
RewriteRule ^ch-fr/?(.*) $1 [E=URL_LOCALE:ch-fr,E=MAGE_RUN_CODE:ch_fr]
RewriteRule ^ch-en/?(.*) $1 [E=URL_LOCALE:ch-en,E=MAGE_RUN_CODE:ch_en]
RewriteRule ^de-de/?(.*) $1 [E=URL_LOCALE:de-de,E=MAGE_RUN_CODE:de_de]
RewriteRule ^de-en/?(.*) $1 [E=URL_LOCALE:de-en,E=MAGE_RUN_CODE:de_en]

############################################
## workaround for HTTP authorization
## in CGI environment

RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

############################################
## TRACE and TRACK HTTP methods disabled to prevent XSS attacks

RewriteCond %{REQUEST_METHOD} ^TRAC[EK]
RewriteRule .* - [L,R=405]

############################################
## redirect for mobile user agents

#RewriteCond %{REQUEST_URI} !^/mobiledirectoryhere/.*$
#RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]
#RewriteRule ^(.*)$ /mobiledirectoryhere/ [L,R=302]

############################################
## always send 404 on missing files in these folders

RewriteCond %{REQUEST_URI} !^/(media|skin|js)/

############################################
## never rewrite for existing files, directories and links

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l

############################################
## rewrite everything else to index.php

SetEnv REWRITE_IS_FINISHED 1
RewriteRule .* index.php [L]

您可以在此处查看:http://www.sponser.ch/

我会非常感谢任何建议。

0 个答案:

没有答案