Home Products Support My Accounts About
You are here: HomePage » Knowledgebase » Technical Guides & Information
 » Support Center » Article
Find Answers FAST!
   Search our Knowledgebase:


How can I force URLs to use/not use SSL?

For Search Engine Optimization (SEO) purposes, it is important to have your website content pages not encrypted. However, pages that require users to input personal data should be encrpted. If your site is encrypting all pages Search Engines will not index them.

A fix is simple, however, using mod_rewrite for Apache. In your ~/public_html directory, create a file named ".htaccess" (or modify an existing one) and put this into it:

The start of your ".htaccess" file needs this once at the top.

RewriteEngine on
Options +FollowSymlinks


The following will only turn "OFF" SSL for the page "index.html"

#Rewrite the URL turn OFF SSL
RewriteCond %{REQUEST_URI} ^/index.html [NC]
RewriteCond %{SERVER_PORT} !^80$
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]

The rule above will force a non encrypted "index.php" page to load. Thus, allowing Search Engines to index the page. The "R=301" tells anyone requesting the "bad" URL that it has been permanently moved to the "good" version. And the "L" means this is the last step in the rule.


The following will only turn "ON" SSL for the page "user.html"

#Rewrite the URL turn ON SSL
RewriteCond %{REQUEST_URI} ^/user.html [NC]
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]


Use of the above rules can help a Search Engine index your site. However, use caution when setting these rules for various pages for your site. It is possible to create a loop going back and forth between non and secured pages.


Rating
Was this article/response helpful?
Votes:
Rating:
1701
9.1/10

Powered by WHMCompleteSolution