Forum Moderators: phranque
RewriteRule ^alpha-beta$ /filename.htm\?page=menu4&sub=content_m4-3 [L]
RewriteCond %{QUERY_STRING} ^page=menu4&sub=content_m4-3$
RewriteRule ^filename\.htm$ http://www.domain.com/alpha-beta? [R=301,L]
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{THE_REQUEST} ^page=menu4&sub=content_m4-3$
RewriteRule ^filename\.htm$ http://www.domain.com/alpha-beta? [R=301,L]
RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]
RewriteRule ^alpha-beta$ /filename.htm\?page=menu4&sub=content_m4-3 [L]
RewriteRule ^alpha-beta$ /filename.htm\?page=menu4&sub=content_m4-3[L]
RewriteCond %{QUERY_STRING} ^page=menu4&sub=content_m4-3$
RewriteRule ^filename\.htm$ [domain.com...] [R=301,L]
Now when I go to the first dynamic version i.e. www.domain.com/filename.htm?page=menu4&sub=content_m4-3, it redirects to static www.domain.com/alpha-beta but then it again gets redirected to itself i.e. www.domain.com/alpha-beta and thus a loop is being generated.
RewriteCond %{The_Request} /filename.html\?page=menu4&sub=content_m4-3\ HTTP/
RewriteRule ^(.*)$ http://www.domain.com/alpha-beta? [R=301,L]
RewriteRule ^alpha-beta$ /filename.html?page=menu4&sub=content_m4-3 [L]
(.*) with the actual path part of the request otherwise the RewriteCond also has to be evaluated for every image request and every request for css or Javascript files. RewriteCond pattern should be ^[A-Z]{3,9}\ / to match with the literal GET part. Escape the literal period in this pattern.