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} ^example.com$ RewriteRule (.*) http://www.example.com/$1 [R=301,L] Another solution RewriteEngine On RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

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/project.com/public_html” sudo mkdir -p /var/www/project.com/public_html 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