Get Paid to Participate - up to $1 per post!     Twitter     Facebook     Google+
Hosting Discussion
 

forgot password?



Reply


Old
  Post #1 (permalink)   02-12-2017, 10:25 AM
HD Amateur
 
Join Date: Feb 2017
Posts: 79

Status: danielpmc is offline
You need to have a SSL certificate in place before using the shown codes. Place one or the other in your cPanel public_html/.htacces file. Important: any .htaccess file must start with a dot and the chmod (pernmissions) are ALWAYS set at 644

If the .htaccess file does not have the "RewriteEngine on" in the file, uncomment by removing the hashtag. This only needs to appear once in the .htaccess file as it will cover all other Rewrites present and future.
Replace example dot com with your domain name

This forces all http pages to No WWW https
Code:
#RewriteEngine on
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://example.com/$1 [R,L]
This forces all http pages to WWW https
Code:
#RewriteEngine on
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]
__________________
Stone soup is flavored by its offerings of humanity.
 
 
 


Old
  Post #2 (permalink)   02-16-2017, 02:52 PM
HD Newbie
 
Join Date: Feb 2017
Posts: 4

Status: LGvps is offline
hello

about your post you can use :

Code:
  RewriteCond %{SERVER_PORT} 80
        RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Regards
__________________
LGvps.com Hosting
LGvps.com Hosting as a cost efficient solution gives you the perfect choice , You'll find everything you need speed and reliability.
https://www.lgvps.com
 
 
The Following User Says Thank You to LGvps For This Useful Post:
danielpmc (02-16-2017)


Old
  Post #3 (permalink)   02-17-2017, 10:08 AM
HD Addict
 
Join Date: Aug 2015
Posts: 127

Status: bigredseo is offline
If the server doesn't have "Rewrites" enabled by default, then your code will no work. You have commented out the first line (using the #).

It's always best to enable that, forcing the rewrites ON and then continuing with your rewrite statements.

You could also wrap the whole things in an IF MODULE statement for even better verification that the module is enabled.
__________________
Conor Treacy
Big Red SEO - Omaha, NE
ConorTreacy.com <- That's Me! ;)
 
 
 
The Following User Says Thank You to bigredseo For This Useful Post:
SenseiSteve (02-17-2017)


Old
  Post #4 (permalink)   02-17-2017, 10:18 AM
HD Amateur
 
Join Date: Feb 2017
Posts: 79

Status: danielpmc is offline
Quote:
Originally Posted by danielpmc View Post
If the .htaccess file does not have the "RewriteEngine on" in the file, uncomment by removing the hashtag. This only needs to appear once in the .htaccess file as it will cover all other Rewrites present and future. Replace example dot com with your domain name
This is in my OP.
__________________
Stone soup is flavored by its offerings of humanity.
 
 
 


Old
  Post #5 (permalink)   02-17-2017, 11:33 AM
HD Amateur
 
Join Date: Feb 2017
Posts: 79

Status: danielpmc is offline
Quote:
Originally Posted by bigredseo View Post
You could also wrap the whole things in an IF MODULE statement for even better verification that the module is enabled.
Is this what you mean?

Code:
<IfModule mod_version.c>
<IfVersion >= 2.4>
SSL Code here
</IfVersion>
</IfModule>

<IfModule !mod_version.c>
<IfModule !mod_authz_core.c>
SSL Code here
</IfModule>

<IfModule mod_authz_core.c>
SSL Code here
</IfModule>
__________________
Stone soup is flavored by its offerings of humanity.

Last edited by danielpmc : 02-17-2017 at 11:38 AM. Reason: typo
 
 
 


Old
  Post #6 (permalink)   02-17-2017, 12:01 PM
HD Amateur
 
Join Date: Feb 2017
Posts: 79

Status: danielpmc is offline
All examples shown above do not require any modules to be enabled beyond RewriteEngine on. They are forcing all traffic regardless if it is http/https coming through port 80 to force a redirection to its counterpart of https. These are not contingent on any SSL module to be enabled, as they are redirection codes to be used in a .htaccess file.
__________________
Stone soup is flavored by its offerings of humanity.
 
 
 


Old
  Post #7 (permalink)   02-17-2017, 02:17 PM
HD Amateur
 
Join Date: Feb 2017
Posts: 79

Status: danielpmc is offline
There is a potential, yet very slight, SEO redirect issue which is reported in Google Webmaster accounts for using this closing tag: [L,R=301]

Why: Because Google generally does not care for hard coded internal page redirects. Yes, some it accepts others it doesnt.

However, Google accepts this tag [R,L] as a soft coded redirect. I have not received a warning for using this tag.
__________________
Stone soup is flavored by its offerings of humanity.
 
 
 
Reply

Thread Tools

New Post New Post   Old Post Old Post
Posting Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Sponsored By: