How to redirect everything from no-www to www except for few files, using .htaccess?
I am using the following .htaccess to redirect no-www to www.
.htaccess
Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^[^.]+\.[^.]+$ [nc]
rewriterule ^(.*)$ http://www.%{http_host}/$1 [r=301,nc]
How do I add exception for few files?
for example:
1) example.com/page1.html should not be redirected to www.example.com
2) example.com/xml/page2.xml should not be redirected to www.example.com
Everything other then example.com/page1.html and example.com/xml/page2.xml should be redirected to www.example.com