View previous topic :: View next topic |
Author |
Message |
JMMotyer -
Joined: 06 Jul 2005 Posts: 60 Location: Burlington (Toronto-ish), Ontario, Canada
|
Posted: Thu Mar 17, 2022 6:27 am Post subject: How to set Abyss X2 to redirect all non-WWW to WWW |
|
|
Hello, folks.
I have my X2 configured to redirect all HTTP traffic to HTTPS, by going to Console | Configure | General | Advanced Parameters | Exclusively Serve On HTTPS | Virtual Path and then adding *, and this has been working flawlessly.
Is there a similarly-easy way for my to get Abyss to do the same for WWW, so that Abyss redirects all incoming non-WWW traffic to WWW ?
I would like that if a user comes in on https://mydomain.com , for Abyss to automatically redirect them to https://www.mydomain.com
Currently I am accomplishing these redirects at the DDNS (NoIP.com) level, but I would like to have Abyss do these redirects to WWW.
I have found on the Internet how to accomplish the redirects using .htaccess files, but am hoping that Abyss itself can do it.
In my current Abyss configuration for each domain, under General, I have both Host Names listed:
Both work fine, it's just that I wish all traffic to be redirected to www.mydomain.com
Am I able to accomplish the redirects using Abyss itself, or is my only option to use .htaccess or at the DDNS level?
Thank you in advance & have yourselves a great day.
Regards & be safe,
John |
|
Back to top |
|
|
Horizon -
Joined: 18 Feb 2022 Posts: 54
|
Posted: Thu Mar 17, 2022 8:19 am Post subject: |
|
|
Hi,
There's a simple solution for what you want to do I think.
(Add the non-www hostname to the list of hostnames your host listens to first.)
Using URLRewrite you can do a rule like this:
Code: | Enabled: Yes
Type: Relative to base
Base Virtual Path: /
Virtual Path Regular Expression: ^(.*)$
Case sensitive: No
[Conditions:]
Header (HTTP_HOST) : Does not match with : ^(?:www\.).*$
Apply to subrequests too: No
[If this rule matches:]
Perform an external redirection: https://www.mydomain.com/$1
Append Query String: Yes
Escape Redirection Location: Yes
Next Action: Stop matching |
I already tested something similar, so I think that this should work.
I can test if needed. |
|
Back to top |
|
|
JMMotyer -
Joined: 06 Jul 2005 Posts: 60 Location: Burlington (Toronto-ish), Ontario, Canada
|
Posted: Thu Mar 17, 2022 8:39 am Post subject: |
|
|
Magic! Thank you.
The only setting that I was not sure of, which was the last one, Status Code, it was originally 302 - Moved Temporarily, and I changed it to 301 - Moved Permanently, is that the correct option for that setting? It works perfectly, just want to make sure that 301 is the correct option.
Thank you again, and have yourself a splendid day.
Regards & be safe,
John |
|
Back to top |
|
|
Horizon -
Joined: 18 Feb 2022 Posts: 54
|
Posted: Thu Mar 17, 2022 8:59 am Post subject: |
|
|
I'm glad that it worked,
Actually the HTTP redirect status codes are a mess...
There are 301, 302, 307 & 308.
Some redirect codes were supposed to be deprecated, some were meant to be used for subtle differences that nobody understood, and so on.
Long story short, Aprelium made our life easier by using the most compatible status codes as default choices.
Choosing between a temporary redirect or a permanent one depends on what you need.
If you 100% want to always redirect non-www to www then use a permanent redirect.
The web browser will remember it and will directly redirect the user instead of making yet another request to your webserver next time the user forgets to write www.
Otherwise if you want it to be temporary, use the temporary one.
That means the user's web browser will keep initially requesting the non-www domain if the user doesn't write the www and your server will have to tell its web browser to visit the www website each time this happens.
Thanks for the splandid day wish :) |
|
Back to top |
|
|
admin Site Admin
Joined: 03 Mar 2002 Posts: 1296
|
Posted: Thu Mar 17, 2022 9:49 pm Post subject: |
|
|
JMMotyer,
It is usually recommended to start with 302 as it s temporary.
Once you are confident that no more changes are expected and that the non-www URL is definitive, you can switch to 301. _________________ Follow @abyssws on Twitter
Subscribe to our newsletter
_________________
Forum Administrator
Aprelium - https://aprelium.com |
|
Back to top |
|
|
JMMotyer -
Joined: 06 Jul 2005 Posts: 60 Location: Burlington (Toronto-ish), Ontario, Canada
|
Posted: Thu Mar 17, 2022 11:17 pm Post subject: |
|
|
Understood. However, all is working perfectly, and I wish this to be permanent.
The only further questions that I have are:
1.) Should I be using 301 - Moved Permanently or should I be using 308 - Permanent Redirect? I'm currently using 301 - Moved Permanently & everything is working perfectly :-).
2.) My CSR has all my domains listed with www for each, and none are listed without the www. Is that OK, or should I include in the CSR all the domains without the www as well?
Thanks in advance, and have a splendid evening.
Regards & be safe,
John |
|
Back to top |
|
|
Horizon -
Joined: 18 Feb 2022 Posts: 54
|
Posted: Thu Mar 17, 2022 11:46 pm Post subject: |
|
|
JMMotyer wrote: | 1.) Should I be using 301 - Moved Permanently or should I be using 308 - Permanent Redirect? I'm currently using 301 - Moved Permanently & everything is working perfectly :-). |
You can keep using the 301 Moved Permanently.
If you wish to grasp more of the semantics, read below :)
Actually, what I understand regarding the two redirect codes is this:
Code: | - 301 means that the user is no longer at the correct URL and the resource is now elsewhere, this is also not temporary - the requested resource will never be at the now-incorrect URL ever again.
- 308 means that the user is at the correct URL which is indeed supposed to redirect the user to elsewhere, and the redirect is not temporary - the web browser should remember it for next time. |
You will want to use 301 because your content is not supposed to be on the the non-www domain.
So you can tell web browsers that the resource they requested is actually not supposed to be on mydomain.com, and then you tell them to instead go to www.mydomain.com.
JMMotyer wrote: | 2.) My CSR has all my domains listed with www for each, and none are listed without the www. Is that OK, or should I include in the CSR all the domains without the www as well? |
You should include the domains without the www as well.
Otherwise if you listen for both the www domain & the one without it, then users who directly type https://mydomain.com in their URL bar will get SSL errors.
Therefore you indeed should have both the www & non-www domains in your CSR.
I hope that I got the redirect codes explanation right, it's not 100% sure but this logic is valid nonetheless (I think). |
|
Back to top |
|
|
JMMotyer -
Joined: 06 Jul 2005 Posts: 60 Location: Burlington (Toronto-ish), Ontario, Canada
|
Posted: Tue May 03, 2022 12:04 am Post subject: |
|
|
Hello again, Horizon.
I'm having a little bit of a hiccup with my redirect settings.
I implemented your rewrite steps for all of my 8 X2 hosts back a couple of months or so ago, and all of them have been working flawlessly since then, thank you.
However, since adding 2 more hosts, the rewriting is not working for those 2 new hosts.
I must mention that the domain names of the 2 hosts that don't redirect are similar, example:
http://fusionwings.com redirects to WWW successfully (note the .COM)
http://fusionwings.me does NOT redirect to WWW successfully (note the .ME)
Likewise:
http://genealogywings.com redirects to WWW successfully (note the .COM)
http://genealogywings.me does NOT redirect to WWW successfully (note the .ME)
For both the .ME domains above, when I manually enter in the WWW they both work fine.
Any thoughts?
Thanks in advance & have yourself a great day.
Regards,
John |
|
Back to top |
|
|
JMMotyer -
Joined: 06 Jul 2005 Posts: 60 Location: Burlington (Toronto-ish), Ontario, Canada
|
Posted: Tue May 03, 2022 12:12 am Post subject: |
|
|
Here I sit, egg on my face (or however that saying goes)... I missed reading your very first step for these 2 new domains:
Quote: | (Add the non-www hostname to the list of hostnames your host listens to first.) |
All is working perfectly now for those 2 .ME domains.
Have yourself a great day.
Regards,
John |
|
Back to top |
|
|
admin Site Admin
Joined: 03 Mar 2002 Posts: 1296
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|