• qlddrones

    (@websupportguy)


    I desperately need some help with redirection of URLS that include the “?lang=XX” query parameter. For some reason URL redirects that are working perfectly without the parameter fail to 404 with the parameter (I’m using the Transposh translation plugin).

    For example:

    http://www.travelnasia.com/thailand/bangkok/don-mueang-airport/ redirects to http://www.travelnasia.com/thailand/don-mueang-airport-bangkok/

    but

    http://www.travelnasia.com/thailand/bangkok/don-mueang-airport/?lang=zh goes to 404

    I’ve tried natural redirects by WordPress (changing the URL in the editor), I’ve tried the Redirect plugin including with regex and I’ve tried every combination I can think of in HTACCESS redirects, but no joy.

    If anyone has any suggestions to try, I would really appreciate it.

    At the moment, the two most likely HTACCESS rules appear to be:

    RewriteCond %{QUERY_STRING}  ^$ [NC]
    RewriteRule ^(thailand/bangkok/don-mueang-airport)$ http://www.travelnasia.com/thailand/don-mueang-airport-bangkok/$1 [R=301,NC,L]
    redirect /thailand/bangkok/don-mueang-airport/$ http://www.travelnasia.com/thailand/don-mueang-airport-bangkok/$1 [R=301,NC,L]

    But of course neither of them actually work.

    BTW I am a web developer, not a programmer, so my regex and htaccess knowledge is somewhat limited. I can usually get them to work, but not in this case.

Viewing 1 replies (of 1 total)
  • Thread Starter qlddrones

    (@websupportguy)

    After more experimentation I seem to have a rule that works, but I don’t know if it’s the best way to achieve what I need.

    RewriteCond %{HTTP_HOST} ^test.travelnasia.com$ [NC]
    RewriteCond %{QUERY_STRING} ^lang=(.*)$
    RewriteRule ^test-redirect/$ http://test.travelnasia.com/destination/hanoi/hanoi-vietnam-destination-guide/$1 [L,QSA]

    Is there a rule I could use, for example, that says for any redirect that has “?lang=XX”, append “?lang=XX” to the destination URL? That way I could just write my redirects normally and let the rule worry about the language query.

Viewing 1 replies (of 1 total)
  • The topic ‘URL redirects not working with ?lang=XX’ is closed to new replies.