Forum Moderators: phranque

Message Too Old, No Replies

Serving different documents for www and the none

         

a1call

3:53 am on Feb 7, 2006 (gmt 0)

10+ Year Member



Hi,
My host has a control panel service where I can setup subdomains.
Can I use such a feature to serve a different document for www.example.com than example.com?
Might this mess things up?
Currently I have a .htaccess 301 redirect to none www from www. Can I modify it so that the redirection works only when the www.example.com/directory does not exist?

Thanks

jdMorgan

4:04 am on Feb 7, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> Can I use such a feature to serve a different document for www.example.com than example.com?

The server can do this. So it would depend on whether your control panel supports it properly.

> Might this mess things up?

Yes, it might indeed. I would not recommend doing this with the "www" subdomain. Any other subdomain would be much safer. This is simply because a lot of search engine spiders and webmasters assume (wrongly) that "www" and "non-www" are always the same site. Many if not most hosting companies set up their servers so that "www" and "non-www" are the same site by default.

> Currently I have a .htaccess 301 redirect to [non-www] from www. Can I modify it so that the redirection works only when the www.example.com/directory does not exist?

Yes, see mod_rewrite's RewriteCond directive, used with the %{REQUEST_FILENAME} variable and the -d flag.

Jim

a1call

4:14 am on Feb 7, 2006 (gmt 0)

10+ Year Member



Thank you jdMorgan,

The AWS forum is dominated by one and two reply threads as a result of your expertize.

My host is indeed setup to serve the same document for www and the none. I have a number of other subdomains setup through the control panel without a problem.
Just to make sure that I understand, Since the server is setup to serve the same document, the Control panel assignment of a new target to www would be a bad idea.
Is this correct?

Thanks again for your great knowledge and help.

jdMorgan

4:39 am on Feb 7, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No, it's a bad idea because you may confuse search engine robots, and harm your sites' rankings in search results.

For example, no matter how many times you tell Yahoo that the canonical domain for your site is "www.example.com" by using a 301-Moved Permanently redirect from "example.com" to "www.example.com", and even if no-one on the Web ever links to "example.com" instead of "www.example.com", Yahoo Slurp will continue to try to fetch pages from "example.com". This is evidence that they are confused between www and non-www domains at some level, and I would avoid confusing them even more.

I never answer control panel questions, because they are all a little bit different, many of them generate 'bad' (sloppy, buggy, non-optimized) code into httpd.conf, and I avoid them as much as possible. Since I don't use them very much, I'm not much good at answering questions about them.

Jim