Monday, 16 January 2017

Redirect To www from non www site for subfolder using .htaccess

I want to redirect from http://domain.com/folder/ to http://www.domain.com/folder/



I have tried below code



RewriteCond %{HTTP_HOST} ^domain.com [nc]
RewriteRule ^(.*)$ http://www.domain.com/$1 [r=301,nc]



AND



RewriteCond %{HTTP_HOST} domain.com [NC]
RewriteRule ^(.*)$ http://www.domain.com/folder/index.html [R=301,NC]


It redirects to http://domain.com/ to http://www.domain.com/
Not http://domain.com/folder/ to http://www.domain.com/folder/



also it redirect to http://domain.com/folder/ to http://www.domain.com/

But not to http://www.domain.com/folder/



Please suggest what issue and help to solve it.
Thanks.

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...