Reputation: 2040
I'm really bad at htaccess, I can't figure this out.
I have the following file:
/site/.htaccess
I would like to create a rewrite that would rewrite:
/site/en/home/
to:
/site/home/?lang=en
and (var
is just an example, it should work with any query string):
/site/en/home/?var=12345
to:
/site/home/?var=12345&lang=en
How can I accomplish this? I've been at it for 1 hour and I can't get it to work.
Upvotes: 1
Views: 91
Reputation: 41219
You can use this in /site/.htaccess
RewriteEngine on
RewriteRule ^en/(.+)/?$ /site/$1/?lang=en [QSA,L]
QSA QueryStringAppand flag automatically appends the addtional queryString to the target.
Upvotes: 1