Posts

Showing posts from August, 2015

URL redirect/rewrite using the .htaccess file

Q How to redirect http to https RewriteEngine on RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L] Q How to redirect http:// to https://www RewriteEngine on RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L] Q How to redirect non-www to www RewriteEngine On RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] Q How to redirect all pages to newdomain RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} !^olddomain\.com$ [NC] RewriteRule ^(.*)$ http://newdomain.com [R=301,L] Q What is meaning of L & R flag in htaccess htaccess L fag causes to stop processing the rule set, if the rule matches, no further rules will be processed htacces R flag causes a HTTP redirect to be issued to the browser and 301 means its permanent redirect. Q How to redirect homepage to another Website Redirect / http://www.khunt.com/ Q How to redirect to another directory within s