Jump to content

.htaccess file not working correctly


paulcruice

Recommended Posts

In my .htaccess file I require that the following sites 

http://www.thelogos.net
http://thelogos.net
https://www.thelogos.net

all be redirected to https://the-logos.net

At the moment the first two redirect correctly but I can't get https://www.thelogos.net to redirect to https://the-logos.net. What is wrong?
Do I need to redirect https://www.thelogos.net to http://www.thelogos.net first then redirect the other two to https://the-logos.net

Among the above .htaccess file redirects, I also require a redirect of this domain, thelogos.au to https://the-logos.net
I would really appreciate your help. 

My current htaccess file (which does not fully work) written by my hosting company is as follows:

RewriteEngine On

RewriteCond %{HTTP_HOST} the-logos\.net [NC]

RewriteCond %{SERVER_PORT} 80

RewriteRule ^(.*)$ https://the-logos.net/$1 [R,L]

RewriteCond %{HTTP_HOST} ^thelogos\.au$ [OR]

RewriteCond %{HTTP_HOST} ^www\.thelogos\.au$

RewriteRule ^/?$ "https\:\/\/the\-logos\.net\/" [R=301,L]

RewriteCond %{HTTP_HOST} ^the\-logos\.net$ [OR]

RewriteCond %{HTTP_HOST} ^www\.the\-logos\.net$

RewriteRule ^thelogos\.au$ "https\:\/\/the\-logos\.net\/" [R=301,L]

RewriteCond %{HTTP_HOST} ^the\-logos\.net$ [OR]

RewriteCond %{HTTP_HOST} ^www\.the\-logos\.net$

RewriteRule ^\https\:\/\/www\.the\-logos\.net$ "https\:\/\/the\-logos\.net\/" [R=301,L]

 

Edited by paulcruice
Link to comment
Share on other sites

Instead of deciding on all the different sites that someone could be accessing, think about this in terms of whether or not they're accessing the site you want them to. It's much easier that way.

Somewhat separately from that, RewriteRule matches on paths, not on hostnames or full URLs.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.