开发者

htaccess redirect add querystring

I'm triying to redirect www.myweb.com to www.myweb.com/?lang=en

Any try i made redirect all the traffic in the website or creates a loop.

A开发者_Go百科ny help?


I thinkg it should be easier for you to set the GET variable lang to 'en' in php, rather than redirecting... In your code, before handling the lang variable, try:

if (!isset($_GET['lang'])) {
    $_GET['lang'] = 'en;
}


If you need to do it via a rewrite rule for whatever reason, this worked for the simple example I tried:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ $1?lang=en [QSA]

Though there are similar questions on stack overflow you should check out: ModRewite and general searching ;)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜