[英].htaccess redirect subfolders
Im struggling with a .htaccess settings to get following: To create Multi-language functionality in my CMS without duplicating the productdatabase I would like to get the content of the default language, but keeping the right url in the addressbar. 我正努力使用.htaccess设置来获取以下信息:若要在CMS中创建多语言功能而不复制productdatabase,我希望获取默认语言的内容,但要在地址栏中保留正确的url。
For example: 例如:
And also for the products: 对于产品:
In short: In case of calling the folders '/en/webshop/' and '/en/collection/' there must be a rewrite to '/webshop' and '/collectie'. 简而言之:如果将文件夹命名为“ / en / webshop /”和“ / en / collection /”,则必须重写为“ / webshop”和“ / collectie”。 Anyone got a clue? 有人知道了吗?
Thanks in advance... 提前致谢...
Use below rule:- 使用以下规则:
RewriteEngine on
RewriteRule ^en/(.*)$ /$1 [L,R=301,QSA]
OR 要么
RewriteEngine On
RewriteRule ^(.*)/en/(.*)$ $1/$2 [R=301,L]
Hope it will help you :) 希望它能对您有所帮助:)
What about: 关于什么:
RewriteEngine on
RewriteRule ^/?en/webshop/(.*)$ /webshop/$1
RewriteRule ^/?en/collection/(.*)$ /collectie/$1
mod_rewrite
第一行仅启用mod_rewrite
/en/webshop
and discards the /en
第二行(第一条规则)匹配/en/webshop
下的所有内容,并丢弃/en
collection
to collectie
第三行与第二行相似,但也将collection
“重命名”为collectie
If you have more folders/paths you want to redirect I 'd suggest adding the rule: 如果您要重定向的文件夹/路径更多,建议添加以下规则:
RewriteRule ^/?en/(.*)$ /$1
which is rewriting anything that starts with /en
. 这将重写以/en
开头的所有内容。
Hope it helps, note it is not tested 希望对您有所帮助,请注意,它尚未经过测试
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.