New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Redirect Domains with WWW (Cpanel/WHM)
I'm having trouble setting up a config file so that if a domain is loaded as 'example.com' it will redirect to 'https://www.example.com'
I have rewrite rule to add TLS under all my accounts but obviously isn't the most efficient solution so I'd like to put it in a config (add www. and https://)
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
How do I set it up?
https://documentation.cpanel.net/display/EA4/Modify+Apache+Virtual+Hosts+with+Include+Files
Comments
check out here : http://bfy.tw/GH8g
Simply edit your .htaccess file and put
I hope this will work fine.
@Rayhan You might want to put a clause in that it doesn't appended www if it's already there..
>
There's a bit of duplication here, but this basically throws you to https://www. no matter where you're going, and sends a 301 which will give pagerank to https:// - possibly. It could be broken into a slightly more logical stanza, but this makes it easy enough to read.
Is that covered on MOZ? never dealt with redirects don't want it to affect the serp
301 are fine, don't worry about that.
Usually, this rule in .htaccess should do the trick -
RewriteEngine on RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https\:\/\/www\.example\.com\/$1 [R,L]
However, if you are using applications like WordPress or similar, you may have to look into its 'SiteURL' settings.