Category Archives: Apache

Redirect non-www to www in .htaccess

Write this code in root’s .htaccess file it will redirect to www if non-www requests found .. RewriteCond %{HTTP_HOST} ^$ RewriteRule (.*)$1 [R=301,L] Another solution RewriteEngine On RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] Advertisements

Posted in Apache | Leave a comment

How to create virtual host in ubuntu 14 ?

create directory under var/www/ folder by this command, to hit command press ctrl+alt+t i “sudo mkdir -p /var/www/” sudo mkdir -p /var/www/ Now it’s time to give permission the folder that we created so hit this command “sudo chown -R … Continue reading

Posted in Apache | 2 Comments