Mobile app version of vmapp.org
Login or Join
Sims2060225

: Need to remove www for only one sub directory from a domain I have a domain like www.example.com. I need to remove www. from specified sub folder by using a .htaccess file. Example :

@Sims2060225

Posted in: #Htaccess #ModRewrite #NoWww #Redirects #WebHosting

I have a domain like example.com. I need to remove from specified sub folder by using a .htaccess file.

Example :

example.com/blog should redirect to example.com
All other sub folders will not redirect in url like example.com/forum will remain untouched. example.com will remain untouched.

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Sims2060225

2 Comments

Sorted by latest first Latest Oldest Best

 

@Megan663

Just use your control panel and create a redirect without www

10% popularity Vote Up Vote Down


 

@Eichhorn148

You can put a rewrite rule like this in place in the .htaccess file. In this example "example.com" is the domain name and "subdirectory" is the name of the folder for which you want to remove the "www".

RewriteCond %{HTTP_HOST} ^www.example.com$
RewriteRule ^subdirectory(/.*)?$ example.com/subdirectory [R=301,L]

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme