我有一个网站,其中包含德语作为默认语言和英语作为替代语言。我想将我的rss url重定向到另一条基于语言条件的网站路径。
我的意思是默认情况下http://www.eample.com/rss.xml到http://www.eample.com/index.php?type=11,在替代语言中是http://www.eample.com/en/rss.xml到http://www.eample.com/index.php?type=11&L=1。
我尝试过以下方法,但它只尊重默认情况。
RewriteRule rss.xml$ /index.php?type=11 [L,R=301]
RewriteRule en/rss.xml$ /index.php?type=11&L=1 [L,R=301]你们能帮我做到这一点吗?
发布于 2015-05-28 07:41:52
试试这个:
RewriteRule ^rss\.xml$ /index.php?type=11 [NC,L,R=301]
RewriteRule ^en/rss\.xml$ /index.php?type=11&L=1 [NC,L,R=301]发布于 2015-05-28 08:20:47
也许还会加入一些regex来捕获其他的国家/语言代码。
RewriteRule ^rss\.xml$ /index.php?type=11 [NC,L,R=301]
RewriteRule ^(en|de|fr)/rss\.xml$ /index.php?type=11&L=$1 [NC,L,R=301]或匹配任何两个字符
RewriteRule ^([a-z]{2})/rss\.xml$ /index.php?type=11&L=$1 [NC,L,R=301]https://stackoverflow.com/questions/30499912
复制相似问题