Home Rewrite in HTACCESS
Reply: 1

Rewrite in HTACCESS

Gabriel Batailleur
Gabriel Batailleur Published in 2018-01-12 18:41:04Z

Can anyone help me here? I did a rewrite for the english version of my site.

It's was mysite.com/?lang=en And now it's mysite.com/en/

I've tried redirecting the URL with this :

RewriteRule ?lang=en$ /en/ [R=301,L]

But each time I put this line in my HTACCESS, the website goes down.

ByteSlinger Reply to 2018-01-12 18:55:25Z

Your rewrite rule is trying to use the parameter portion of the URL. There is an existing SO answer with an example:

HTAccess Rewrite based upon a Parameter Value, ignore other Parameters

Perhaps something like this will help:

RewriteEngine On

RewriteCond %{QUERY_STRING} (?:^|&)(lang=en+).+ [NC]
RewriteRule ^en$ %{REQUEST_URI}?%1 [R=302,NE,NC,L]
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.321909 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO