user2086266
user2086266

Reputation: 3

RewriteRule on static url

I'm putting online a new version of my site and i have to redirect some old indexed pages to the new ones. So i have generated an htaccess based on static urls (the old ones redirecting to the new ones).

It work for some of them but it figure out that it make 404 errors on the ones that own get parameters (I think that's the cause).

There is 2 rules, the working one and the one that fails :

<IfModule mod_rewrite.c>
RewriteEngine on
#Working one
RewriteRule old_page_indexed.htm http://newsite.com [R=301,L] 
#Not working
RewriteRule PBBios.asp?PBMInit=1 http://newsite.com [R=301,L] 
</IfModule>

I've tried to following but not working :

RewriteRule PBBios.asp\?PBMInit=1 http://newsite.com
RewriteRule ^PBBios.asp\?PBMInit=1$ http://newsite.com

Do you have any idea how to do this in htaccess?

Thanks a lot =)

Upvotes: 0

Views: 241

Answers (1)

Wing Lian
Wing Lian

Reputation: 2418

Test against the path and query string independently

RewriteCond %{REQUEST_URI} ^PBBios.asp$
RewriteCond %{QUERY_STRING} ^PBMInit=1$
RewriteRule ^(.*)$ http://newsite.com [R=301,L]

Upvotes: 1

Related Questions