Apache + url重写

时间:2012-08-29 07:54:22

标签: apache url-rewriting

我遇到了“我网站上的重定向太多”的Apache问题。我一直试图以不同的方式解决它,但我找不到解决方案。

referer = http://www.mysite.com/
lang = en | es | fr
page = page1, page2, page3

eg: referer/lang, referer/lang/
eg: referer/lang/page, referer/lang/page/
eg: referer/lang/something/apage, referer/lang/something/apage/

以下是我的规则:

//Rewrite my ajax page location to avoid problems due to /lang/
RewriteRule ^(?:en|es|fr)/{0,1}ajax/ajax.php$ ajax/ajax.php [L]

//Rewrite /lang without page
RewriteRule ^(en|es|fr)/{0,1}$ /?lang=$1 [L]

//Rewrite referer/lang/something/unepage
RewriteRule ^(en|es|fr)/(somethinges|somethingfr|somethingen)/(apage1|apage2|apage3)$ /?lang=$1&page=$3 [L]

//Rewrite /lang/page
RewriteRule ^(en|es|fr)/(.*)$ /?lang=$1&page=$2 [L]

我试图通过%{HTTP_REFERER}重新/?... ...

0 个答案:

没有答案