0

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

4

1 回答 1

1

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]


To allow any query param values use

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]
于 2013-10-29T16:24:17.673 回答