Redirect non www to www for inner pages in PHP through htaccess

It is common to get redirect codes for homepage, home urls or index.php and index.html or any other home pages url.

We can get htaccess codes for making the same technique to work or innerpages when the www from the url is not present and make it to redirect to a www url.

Following are the htaccess code for making the non www redirect to www for inner pages of website.

RewriteCond %{HTTP_HOST} !^www.
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

798 total views, 1 views today

Leave a Comment