Forum Moderators: phranque
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^apply.php https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
RewriteRule ([^/]+)?apply\.php
RewriteRule apply\.php$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
RewriteCond %{HTTPS} off
RewriteRule apply\.php$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
I wasn't sure if putting the end-of-string anchor would mean that it would not match when URL parameters are used (ie. apply.php?param=ABC) but I tested it and it is working fine.
I was thinking that with ([^/]+)? I would avoid any potential odd recursion issues by making sure it was checking for apply.php in the root or a subdirectory...
I have a base to www redirect but I don't know if UseCanonicalName is On.
the RewriteBase directive is not required here. This only affects relative path substitutions
The RewriteBase directive only applies in internal rewrites, not external redirects, ...
Don't the Apache docs clearly and unambiguously say that the default value for RewriteBase is / for root?
Somewhere along the line they seem to have lost track of this detail and are instead trying to send me up a physical directory path.
Default: None
RewriteBase /
takes up 14 or 15 bytes depending on platform. I doubt most people have that many internal rewrites, so we don't even need to argue about which form is more economical ;)