Skip to main content

Posts

Showing posts with the label .htaccess

Use .htaccess to Redirect to HTTPS

If you are using apache webserver and would like to redirect all your traffic to the Secured Socket Layer protocol SSL, you may do that by editing the .htaccess file which resides on the html root of your hosting directory. To do so please add the below lines to your .htaccess file: #HTTPS Redirect <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTPS} !=on RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L] </IfModule> #End HTTPS Redirect

How to enable mod_rewrite on Apache?

The question is – how do I check if mod_rewrite is enabled? If it is disabled, how to I enable it on Apache on CentOS? To enable mod_rewrite, you need to make sure that you have it as a module, and to make sure that Apache has loaded the module. And then you need to ensure that Apache is configured to make use of the .htaccess file for each directory. Follow this article and you should be able to enable mod_rewrite .