Anything missing a trailing slash redirects to https
Dave Myron
Friday 21 January 2005 11:54:32 am
This:
# IF URI does not end with "/" ###################
RewriteCond %{REQUEST_URI} !/$
# and IF URI does not end with <anything> <dot> <something>
RewriteCond %{REQUEST_URI} ![^.]*\.[php|html|gif|css|jpe?g|png|ico|js|asf|avi|wmv|swf|xsl|jar|pdf|doc]+$
#RewriteCond %{REQUEST_URI} [index\.php]+$
# THEN append trailing slash and redirect the client (include support for SSL)
RewriteCond %{HTTP_HOST} (.+)
RewriteCond %{SERVER_PORT} !^443$
RewriteRule (.*) https://%1/$1/ [L]
tells Apache to redirect any non-SSL requesting that doesn't end with a slash or a dot something to redirect to https (with a slash at the end).
This is a large problem: You can't login (if you don't have HTTPS support) - The link from the home page is to /user/login and that satisfies all conditions (no trailing slash and no dot something and not using port 443) so it attempts to forward to https://<domain>/user/login. Not the intention.
Anything missing a trailing slash redirects to https
Dave Myron
Friday 21 January 2005 11:54:32 am
# IF URI does not end with "/" ###################
RewriteCond %{REQUEST_URI} !/$
# and IF URI does not end with <anything> <dot> <something>
RewriteCond %{REQUEST_URI} ![^.]*\.[php|html|gif|css|jpe?g|png|ico|js|asf|avi|wmv|swf|xsl|jar|pdf|doc]+$
#RewriteCond %{REQUEST_URI} [index\.php]+$
# THEN append trailing slash and redirect the client (include support for SSL)
RewriteCond %{HTTP_HOST} (.+)
RewriteCond %{SERVER_PORT} !^443$
RewriteRule (.*) https://%1/$1/ [L]
tells Apache to redirect any non-SSL requesting that doesn't end with a slash or a dot something to redirect to https (with a slash at the end).
This is a large problem: You can't login (if you don't have HTTPS support) - The link from the home page is to /user/login and that satisfies all conditions (no trailing slash and no dot something and not using port 443) so it attempts to forward to https://<domain>/user/login. Not the intention.