Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm using wordpress on hostgator and for some reason root domain is directing to apparently different code to the www subdomain.

That is to say, this:

http://www.domain.com

is producing different html to:

http://domain.com

Yet they both (seem) to point to (I'm fuzzy on how to check this in cPanel though):

/home/me/public_html/domain.com

I've sought and destroyed all the caches I could find.

I've left it 12 hours in case it was the host's caching -- but if it is nothing's flushed yet.

It's on a shared account on hostgator.

Any ideas for tests/checks?

share|improve this question
    
What's the difference in the code? –  slhck Mar 11 '13 at 8:07
1  
Some hosts offer caches that have (way too long) a retention. Try adding a GET variable to your url, like http://domain.com?flush=me. –  BloodPhilia Mar 11 '13 at 8:12
    
Are you 100% certain the code is the same? Also, delete your cache/browser history etc (if convenient to do so) and see if the same error persists. –  Dave Rook Mar 11 '13 at 8:59
add comment

2 Answers

"www" is a sub-domain which may (or may not) point to the same address your (second-level) domain points to. I seem to recall it is possible to configure redirections from within cpanel, so what you need to do is redirect www.domain.tld to domain.tld (or vice versa, depending on which one displays the "correct" html). Better still you might want to do some reading on DNS and spend some time to understand what's the purpose of the different resource records (RRs), especially the A record.

If you're running linux (or if you've got cygwin) you can always install the dnsutils package, which provides dig, which in turn is a very nice command line utility that helps you retrieve any RR for any domain you want. Or you can use one of the many online dig tools out here, e.g. kloth.net's.

share|improve this answer
    
You can manage subdomains in cpanel: domain.com:2083/frontend/x3/subdomain/index.html, but mucking with this only caused redirection loops in the above case. –  Robert J. Mar 13 '13 at 3:06
add comment
up vote 0 down vote accepted

Turns out the problem was in something that was an default set-up rewrite rule in the .htaccess. I should set up the rewrite in the .htaccess regardless.

Thanks for the great comments! ?flush=me is a nice tip.

To be sure to be sure I removed offending cruft added the a rewrite rule to permanently redirect from non-www to www:

# Redirect to www
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

ps. I never used to appreciate the law about either having www or not and just used to lazily set up both. But a few times recently I've had my arse seriously kicked by having the 2 different sessions that are created and the confusion caused therein. I appreciate the law about have a 1 cardinal URL only now. www or not: pick only one.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.