Forum Topic: Need to force www in the public html folder only

Forum: .htaccess Forum : General • Posted by Bronwyn • Post Date:

Hi, wasn't sure where to post this.

If wrong spot, sorry.

I have no idea how to do this

Need to force www in the public html folder only

all other folders should not require it

Any help appreciated

Thanks :-)

5 Replies to “Need to force www in the public html folder only”

Jeff Starr
Posted by Jeff Starr

It should be do-able. Allow me to ask, by the public_html folder, are you referring to the root directory of your site? For example, you want to force www for http://example.com/ but not http://example.com/any-other-directory/..?

Posted by Bronwyn •

Hi Jeff,

yes that is correct, I want to force www for http://example.com/ but not http://example.com/any-other-directory/.

Jeff Starr
Posted by Jeff Starr

Hi Bronwyn,

This is a great question and I've spent a couple of hours trying to match only the root URL, but no luck. One workaround would be to just require www for all URLs, which is explained on page 62 (section 5.1) in the book. I hope that helps!

Posted by Bronwyn •

Thanks :-)

can do that easily enough, however subdomains wont work with www (which from vague memory is to do with the server config in this instance)

Thanks

Bronwyn

(sorry whims is my usual online nick lol)

Jeff Starr
Posted by Jeff Starr

Ahh, www and subdomains ring a bell.. I did some work on this issue not too long ago: Canonical URLs and Subdomains with Plesk maybe that will help?