Redirect all non www to www Except Some Path

Redirect all non www to www Except Some Path

Redirect using .htaccess file

In public_html folder of your domain create a .htaccess file with this content

RewriteEngine on
RewriteRule !^forum($|/){REQUEST_URI} [L,R=301]

This will Redirect all non www to www version of website except a path /forum or /forum/

It is Usefull For those Blogger Users who is hosting their own Domain in blogger, Who want to make some own coding pages on their website. I was seeking this solution since long time by time I get This Which Helps me The Best way.

For Redirecting all non www to www except Some Path Rewrite The .htaccess file as

RewriteEngine on
RewriteRule !^(forum|test)($|/){REQUEST_URI} [L,R=301]

Just Add (and add any path you want not to redirect and sepa|rate with |)

This Domain was hosted on blogger and i had Created a simple Forum in Php i want insert it on my own Domain but We cant upload files in Blogger. So I need to redirect to But as Usual.

There is another way Like Creating redirect in index.php  But it does not help as i Had not Created any 404 error page and many more.

If You Just Want to Redirect Non www to www (Not Related with Blogger)
Just Create a .htaccess file with following Content:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^ [NC]
RewriteRule ^(.*)$$1 [L,R=301,NC]

This Will Redirect all Request For to
It was as we visit it is Redirected to

If you Get any 500 Internal Error Check corectly The Code is Fine.

About Author

This is Sagar Devkota Co-Founder of Time and Update. I write about Online Earning Blogging web hosting and domain registration tutorials local technical news and some time about Cryptocurrency mainly Bitcoin. I also write about Git, Github, C, Django, Linux (ubuntu), Cloud Server. Studying Bachelor of Software Engineering.

Leave a Reply

Your email address will not be published. Required fields are marked *