0

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?

3
  • What's the difference in the code?
    – slhck
    Mar 11, 2013 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.
    – Pylsa
    Mar 11, 2013 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
    Mar 11, 2013 at 8:59

2 Answers 2

0

"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.

1
  • 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.
    – Williams
    Mar 13, 2013 at 3:06
0

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .