Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Web Hosting for WordPress (http://forum.bytesforall.com/forumdisplay.php?f=13)
-   -   [SOLVED] Missing my "www"?? (http://forum.bytesforall.com/showthread.php?t=1001)

Shepherd Jim Mar 29, 2009 07:56 AM

[SOLVED] Missing my "www"??
 
I've been noticing something new/different.

I've always entered my website's address / URL as "www.hatchtown.com" the leading "http://" and trailing "/index.html" were always automatically inserted/provided by the browser and/or internet internal systems.

Lately (since switching to WordPress?), I'm noticing my site's URL shows up in my browser (usually Firefox) at JUST http://hatchtown.com even when I've entered the address with the www

What's changed?!

Flynn Mar 30, 2009 01:12 PM

You probably have a redirect from www.domain.com -> domain.com in your htaccess file, or directly in the webserver configuration file (less likely but possible).
It's a good thing to decide on one version, either domain.com or www.domain.com and then redirect both users and search engines to the preferred version. For the search engines it is better if a "301" redirect was set instead of one without "301". You should see something like "R=301" mentioned in your .htaccess file.

Shepherd Jim Mar 30, 2009 04:14 PM

I looked at a couple of .htaccess files I found but did not see any mention of any redirect

I've kept a "legacy" file from my "old" website. It's in the root directory and it's URL as shown in the browser is "http://www.hatchtown.com/nostdir.html". Meanwhile, as soon as I click a link back into the WP installation I get URLs like "http://hatchtown.com/tools/misc-tools" (no "www").

Checking the WP Settings in the Dashboard:

WordPress address (URL) = "http://hatchtown.com/wp"

Blog address (URL) = "http://hatchtown.com"

We've always published our URL as www.hatchtown.com -- I think people expect a website to start out with the www. How do I go about getting the w's back?

Flynn Mar 30, 2009 07:24 PM

If you change these

WordPress address (URL) = "http://hatchtown.com/wp"

Blog address (URL) = "http://hatchtown.com"

to

WordPress address (URL) = "http://www.hatchtown.com/wp"

Blog address (URL) = "http://www.hatchtown.com"

it should work if the web server is set to serve bot www.domain and domain from the same directory.

If not, you may have trouble getting to the site again after you made these changes. In that case you'd have to manually edit, with PHPMyAdmin or something else, in the WP database, in the table wp_options, the values of row 1 ('siteurl') and row 39 ('home')

Shepherd Jim Mar 31, 2009 06:01 AM

Quote:

Originally Posted by Flynn (Post 3865)
...<snip>...it should work if the web server is set to serve bot www.domain and domain from the same directory.

If not, you may have trouble getting to the site again after you made these changes. In that case you'd have to manually edit, with PHPMyAdmin or something else, in the WP database, in the table wp_options, the values of row 1 ('siteurl') and row 39 ('home')

Okay! Now you're scaring me!!

Could this have anything to do with something GoDaddy might have done. At some point in the transition from my old html/table website to the new WP-powered one I spoke to GoDaddy tech help and I remember discussion of redirects. I don't remember the specific reason for my call to them.

Flynn Mar 31, 2009 07:10 AM

I suggest that you contact Godaddy again and ask them to configure a "301 redirect from domain.com to www.domain.com" instead of the other way round

Shepherd Jim Apr 1, 2009 02:43 PM

I talked to GoDaddy, didn't get the impression the guy I had on the phone was a real expert on redirects, but he said there wasn't anything on their end which would be causing the disappearance of my "www."\

We looked at the contents of the .htaccess file that's in the root directory, but there didn't seem to be anything in there that would amount to a redirect:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
But now, having done just a bit of research I have learned that the above IS some kind of redirect. Since I deleted the old index.html file in the root is it necessary to have the above to force browsers to "grab" onto index.php in its absence?

I found these lines that are supposed to correct "canonical URL errors"
RewriteEngine On
RewriteCond %{HTTP_HOST} ^websitename\.com$ [NC]
RewriteRule ^(.*)$ http://www.websitename.com/$1 [R=301,L]
-- can I just add them to the existing .htaccess?
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteCond %{HTTP_HOST} ^hatchtown\.com$ [NC]
RewriteRule ^(.*)$ http://www.hatchtown.com/$1 [R=301,L]
</IfModule>
What do you think?

Flynn Apr 2, 2009 04:41 AM

I had to read up on this...

Since version 2.3 Wordpress does the 301 redirect for you. That means no 301 redirect with htaccess is required anymore

Since you don't seem to have an existing www.domain -> domain redirection with htaccess anywhere, the redirection is clearly caused through the Wordpress settings, see post #4

So if you want your site to run on www.domain.com, set

WordPress address (URL) = "http://www.hatchtown.com/wp"

Blog address (URL) = "http://www.hatchtown.com"

The

RewriteCond %{HTTP_HOST} ^hatchtown\.com$ [NC]
RewriteRule ^(.*)$ http://www.hatchtown.com/$1 [R=301,L]

looks good however it is not required, and may somehow interfere with the 301 that WP already does.

Shepherd Jim Apr 2, 2009 07:54 AM

Thanks for the "reading"! I've been doing some research myself and it's fascinating to see some of the really useful things you can do using the .htaccess.

If I manage to do this without screwing it up, will there be an effect on Permalinks? Will I lose links to all our posts.

Flynn Apr 2, 2009 07:29 PM

You shouldn't loose anything. These are just 2 settings in the database

Shepherd Jim Apr 5, 2009 08:28 AM

All is right with the world! ...well, at least in my little corner of it!

Both my websites now show the canonical URL "www" in the browser URL window. Wordpress is running in a subdirectory /wp/ but that doesn't show in the browser.

BTW: there's a setting in Google's Webmaster Tools where you specify whether you want Google to just look at your site's pages with or without the "www."

AND! ...there's an intense debate going on amongst the web technorati about "www": is it necessary? evil? useless?

While I plan to keep reading about all this, for the time being, I'm old-school and come from a time where the only REAL website had names that started with "www" and end with dot com -- anything else was suspect.


All times are GMT -6. The time now is 09:09 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.