Reputation: 3
How do i rewrite /blog/?p=1
to /en/post.html
and /blog/?tag=event
to /en/tags.html
whilst the variables are still accesible?
I used this before:
RewriteRule ^blog/?$ /en/tags.html [QSA,L]
But then I had to also rewrite a different variable that is also behind /blog/ and I'm not sure on how to do this.
Thanks in advance
Upvotes: 0
Views: 36
Reputation: 51711
You need to inspect the %{QUERY_STRING}
as
RewriteCond %{QUERY_STRING} (^|&)p=1(&|$) [NC]
RewriteRule ^blog/?$ /en/post.html [NC,QSA,L]
RewriteCond %{QUERY_STRING} (^|&)tag=event(&|$) [NC]
RewriteRule ^blog/?$ /en/tags.html [NC,QSA,L]
RewriteCond %{QUERY_STRING} (^|&)p= [NC]
RewriteRule ^blog/?$ /en/post.html [NC,QSA,L]
RewriteCond %{QUERY_STRING} (^|&)tag= [NC]
RewriteRule ^blog/?$ /en/tags.html [NC,QSA,L]
Upvotes: 1