HostOnNet Blog

SSL Redirecting to https page

A client want all pages in her web site secured.

SSL was already installed on the domain name. So all pages, if access with SSL url was secure

https://myyoffi.com

But she need all visitors see secure page regardless of what URL they use. For example

http://www.myyoffi.com/anything
http://myyoffi.com/anything

Should redirect to

https://myyoffi.com

This can be done by mod_rewrite. You can put this on Apache configuration file (httpd.conf) or just create a .htaccess file and upload to root folder of the server.

If you edit httpd.conf, it should be some thing like below. You have to edit the path to suit your web site.

<Directory “/svr/www/htdocs/test”>
RewriteEngine on
Options +FollowSymLinks
Order allow, deny
Allow from all
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
</Directory>

If you use .htaccess method, use

RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^.*$ https://myyoffi.com%{REQUEST_URI} [L,R]


Posted in Windows. Bookmark the permalink.