modRewrite without filename, with query string

Alles, was den Apache betrifft, kann hier besprochen werden.

modRewrite without filename, with query string

Postby wurstbrot » 07. December 2008 16:30

Hello,

I want to redirect a page with given query string. For example:

Code: Select all
www.domain.de/?s=bla
=> www.domain.de/bla


If I would have to redirect this page...

Code: Select all
www.domain.de/index.php?s=bla
=> www.domain.de/bla


...following code will do:

Code: Select all
RewriteCond %{QUERY_STRING} ^s=bla$
RewriteRule ^index.php$ www.domain.de/bla? [NC,R=301,L]


But when I want not to use the filename, I cannot achieve the redirect. I have tried this:

Code: Select all
RewriteCond %{QUERY_STRING} ^s=bla$
RewriteRule ^/$ www.domain.de/bla? [NC,R=301,L]


and

Code: Select all
RewriteCond %{QUERY_STRING} ^s=bla$
RewriteRule ^$ www.domain.de/bla? [NC,R=301,L]


Both attempts failed cause of redirect loops.

Has anyone a solution?

Wurstbrot
wurstbrot
 
Posts: 1
Joined: 07. December 2008 16:24

Return to Apache

Who is online

Users browsing this forum: No registered users and 22 guests