Forum Moderators: phranque
Hi,
I am having problems configuring .htaccess. The first rewrite rule for http:// to http://www seems to work fine but the https:// to http://www doesn't seem to.
I have 'Force SSL' enabled for the 'Administrator only' in Joomla but when I try and login I am getting thrown back to the login screen.
I'm wondering if these rules are conflicting somehow... can anyone confirm that this should work or suggest a fix.
Thanks in advance, DM.
--
########## Begin - Rewrite rules to enhance SEO SEF
#
RewriteCond %{HTTP_HOST} ^mydomain.com$ [NC]
RewriteRule ^(.*)$ http://www.mydomain/$1 [R=301,L]
#
RewriteCond %{HTTPS_HOST} ^mydomain.com$ [NC]
RewriteRule ^(.*)$ https://www.mydomain/$1 [R=301,L]
#
########## End - Rewrite rules to enhance SEO SEF
--
I am having problems configuring .htaccess
I want to direct traffic for http:// to [www....] I also want to direct traffic for https:// to [www....] at the same time.
Apache/2.2.3 (Debian)
Control Panel Plesk
Environment Joomla 1.5.9
So far I have:
########## Begin - Rewrite rules to enhance SEO SEF
#
RewriteCond %{HTTP_HOST} ^mydomain.com$ [NC]
RewriteRule ^(.*)$ http://www.mydomain/$1 [R=301,L]
#
RewriteCond %{HTTPS_HOST} ^mydomain.com$ [NC]
RewriteRule ^(.*)$ https://www.mydomain/$1 [R=301,L]
#
########## End - Rewrite rules to enhance SEO SEF When I 'Force SSL' enabled for the 'Administrator only' in Joomla and go to the admin login page [www ]. and try and login I am getting thrown back to the login screen under [www....]
I'm wondering if these rules should work? or are conflicting? or there is a bug in Joomla?
Thanks in advance, DM.
One rule is all you really need, as long as that rule takes the current http/https protocol into account:
RewriteCond %{HTTP_HOST} ^example\.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www\.example\.com\. [NC,OR]
RewriteCond %{HTTP_HOST} ^www\.example\.com:[0-9] [NC]
RewriteCond %{SERVER_PORT}>s ^(443>(s)¦80>s)$
RewriteRule (.*) http%2://www.example.com/$1 [R=301,L]
This modified rule also correct requests made with FQDNs or with a port number appended to the hostname.
Important: Replace the broken pipe character "¦" in the RewriteCond pattern with a solid pipe character before use; Posting on this forum modifies the pipe characters.
Jim
I want to direct traffic for http:// to [www....] I also want to direct traffic for https:// to https://www. at the same time.
Thanks in advance, DM.
I want to direct traffic for http:// to [www....] I also want to direct traffic for https:// to https://www. at the same time.
What do I need to modify on your example to get this to work?
RewriteCond %{HTTP_HOST} ^example\.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www\.example\.com\. [NC,OR]
RewriteCond %{HTTP_HOST} ^www\.example\.com:[0-9] [NC]
RewriteCond %{SERVER_PORT}>s ^(443>(s)¦80>s)$
RewriteRule (.*) http%2://www.example.com/$1 [R=301,L]
Kind regards, DM.