Forum Moderators: phranque
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.yoursite.com/$1 [R,L]
</IfModule> Redirect 301 /directors.htm /category/directors is the server clever enoug
is the server clever enough to do one 301 URL redirect?
Once a redirect has been issued, it can't be canceled by any other redirect.
# errordocument after rewrites
RewriteRule my-custom-403\.html - [L]
to prevent infinite loops. Seems like this would have to go before all other RewriteRules, particularly the ones concerned with access control. (Once on a test site I blundered somewhat appallingly on this point: I hadn't bothered to code an error document override, but did have a www redirect, so all my blocked visitors who'd asked for the wrong hostname turned into explicit requests for "forbidden.html". It took me an embarrassingly long time to figure out why it was happening. Luckily it was only a test site.)
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteBase /
RewriteCond %{THE_REQUEST} ^.*/index.html
RewriteRule ^(.*)index.html$ https://www.domain.com/$1 [R=301,L]
RewriteRule ^/directors.html$ https://www.domain.com/directors [R=301,L]
RewriteCond %{QUERY_STRING} ID=1$
RewriteRule ^review\.asp$ https://www.domain.com/reviews/scarface? [R=301,L]
RewriteRule ^(.*)$ https://www.domain.com/$1 [R,L]
</IfModule>
RewriteCond %{SERVER_PORT} 80
Learn something every day
RewriteCond %{SERVER_PORT} 80
I am not sure about using [NS] as the query string ID value are uppercase as the site was originally windows.