开发者

htaccess redirect add querystring

开发者 https://www.devze.com 2023-02-24 04:52 出处:网络
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.

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

精彩评论

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