1

I have this url in my blog:

http://www.myweb.com/

and would like to change into:

http://www.myweb.com/?lang=en

all the URl, of course, in the same page = index.php I need to use param lang=en to grab and change the page into a canonical page which I decide at http://www.myweb.com/index.php?lang=en. I've done with this follows and it didn't give it work. please.

I also try this: Redirect Page after question mark to the same page? but, browser reported that page isn't redirecting properly.

1 Answer 1

1

Maybe this would help?

RewriteEngine On

RewriteCond %{QUERY_STRING} !(^|&)lang=en(&|$) [NC]
RewriteCond %{HTTP_HOST} ^www\.myweb\.com\/index.html$ [NC]
RewriteRule ^ %{REQUEST_URI}?lang=en [L,R=301,QSA]

Only for homepage on addon domain (assuming your addon domain is http://YourAddOn.Domain.com):

RewriteEngine On

RewriteCond %{QUERY_STRING} !(^|&)lang=en(&|$) [NC]
RewriteCond %{HTTP_HOST} ^YourAddOn\.Domain\.com$ [NC]
RewriteRule ^ %{REQUEST_URI}?lang=en [L,R=301,QSA]
5
  • There are tons of htaccess in related to this bored issue, but I still get confused of using and not work. It's very important for me. you did it. it works like I do wish ^_^. thanks soooooooo much.
    – don magug
    Commented Jan 25, 2016 at 2:35
  • but how to make it work in homepage only. that adds all URLs.
    – don magug
    Commented Jan 25, 2016 at 8:18
  • 1
    i updated my answer: assuming your homepage is www.myweb.com/index.html
    – Evgeniy
    Commented Jan 25, 2016 at 8:31
  • 1
    it removes the url param (both homepage & sub dir). my web is on addon domain. does it affect it?
    – don magug
    Commented Jan 25, 2016 at 9:31
  • upd: homepage on addondomain
    – Evgeniy
    Commented Jan 25, 2016 at 15:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.