We are trying to redirect the requests to the old https address to the new http address. The website runs on Joomla and all the code mentioned below are in root .htaccess under htdocs.
Old https address: [
portal.mydomain.com...]
New http address: [
mydomain.com...]
Please note that www.mydomain.com/new-login is a web page, not a subdirectory. We use Joomla and that is how page URLs are displayed.
We've been using a portal at [
portal.mydomain.com...] but our organization recently decided to do without it to save money. So, we created a new login page at [
mydomain.com...] (again, this is a web page, not a directory) and told users to go there to login to company systems. Most users are now using this page to log into the systems but some still use a bookmark and go to the old [
portal.mydomain.com,...] which is now taken down and no longer available. If they try to go there, they will see an error "page cannot be displayed". So, we want to redirect those requests to the new http address.
Working Redirect:
We have another redirect in the root .htaccess and it is working fine. The following code will redirect mydomain.com to www.mydomain.com.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^mydomain\.com$ [NC]
RewriteRule ^(.*)$ [
mydomain.com...] [R=301,L]
Non-Working Redirect:
I tried the following code and I just get an error "page cannot be displayed". I don't see any errors in error.log either. By the way, I simply added the code right below the working code I listed above. So, together, I have it like below in the root .htaccess:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^mydomain\.com$ [NC]
RewriteRule ^(.*)$ [
mydomain.com...] [R=301,L]
RewriteEngine On
RewriteCond %{SERVER_PORT} ^443$
RewriteRule ^(.*)$ [
mydomain.com...] [R=301,L]
I also tried the following to see if I can redirect to the main home page rather than the "new-login" page but I get the same "page cannot be displayed" error.
RewriteEngine On
RewriteCond %{SERVER_PORT} ^443$
RewriteRule ^(.*)$ [
mydomain.com...] [R=301,L]
I hope this explains a little better.