Tutorial :Redirect .html but not .html?with=options


I'm currently using an .htaccess to get round a problem with a CMS, nothing major and an htaccess fix is tidy enough.

I'm currently using the format...

redirect 301 /pictures.html http://www.domain.com/gallery.html

The problem though this causes is that the CMS uses pictures.html?vars=here to select galleries and so the redirect breaks this part of it. Is there any way I can redirect pictures.html but not when it has variables attached?


For example, add something like

RewriteCond %{QUERY_STRING} ^$  

before your rule.


You can redirect everyone except your webserver by detecting the IP address like so:

Options +FollowSymlinks  RewriteEngine on  RewriteCond %{REMOTE_HOST} !^123\.45\.67\.89  RewriteRule \.html$ /alternate_page.html [R=301,L]   

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »