rob
rob

Reputation: 1

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.
Any help?

Upvotes: 0

Views: 812

Answers (2)

Christopher
Christopher

Reputation: 1358

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 ;)

Upvotes: 0

Vlad
Vlad

Reputation: 324

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;
}

Upvotes: 1

Related Questions