Life In 19x19
http://www.lifein19x19.com/

Canonical URL via modrewrite
http://www.lifein19x19.com/viewtopic.php?f=14&t=193
Page 1 of 2

Author:  ross [ Fri Apr 23, 2010 8:29 am ]
Post subject:  Canonical URL via modrewrite

As others have mentioned, this can affect logging in issues, SEO, etc., so best to get this sorted quickly. You need an .htaccess file in the root of your domain, modrewrite enabled, and this text in the file:
Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.lifein19x19\.com [NC]
RewriteCond %{HTTP_HOST} !=""
RewriteRule ^(.*)$ http://www.lifein19x19.com/$1 [L,R=301]


This will ensure that if somebody leaves off the "www", or visits the site using another domain name that points here, the URL will get canonicalized to its proper, "one true form". There can be only one!

Author:  ChradH [ Fri Apr 23, 2010 8:40 am ]
Post subject:  Re: Canonical URL via modrewrite

ross wrote:
This will ensure that if somebody leaves off the "www", or visits the site using another domain name that points here, the URL will get canonicalized to its proper, "one true form". There can be only one!

One question: Are you suggesting to add "www." to every url? How about the other way round?

I find this "www." prefix highly redundant and really hate sites that only work when it's added. Please, let's keep it short and simple.

Author:  Chew Terr [ Fri Apr 23, 2010 8:42 am ]
Post subject:  Re: Canonical URL via modrewrite

He/they are making it so that you do NOT have to add the www. Fear not =)

Author:  ross [ Fri Apr 23, 2010 8:45 am ]
Post subject:  Re: Canonical URL via modrewrite

ChradH wrote:
One question: Are you suggesting to add "www." to every url? How about the other way round?

I find this "www." prefix highly redundant and really hate sites that only work when it's added. Please, let's keep it short and simple.

The site will work either way, it's just a matter of how it shows up in the URL bar (and how search engines and cookies treat it, etc). I'm agnostic as to which way is better, I just think it should be standardized. You probably don't even notice the sites that put it on automatically for you, only the misconfigured sites that don't allow the "www." at all.

Author:  fwiffo [ Fri Apr 23, 2010 8:57 am ]
Post subject:  Re: Canonical URL via modrewrite

I don't care which version we use, we just need to pick one. I've actually been having DNS issues with the www version, weirdly enough, so I guess I favor the shorter version...

Author:  ChradH [ Fri Apr 23, 2010 8:58 am ]
Post subject:  Re: Canonical URL via modrewrite

ross wrote:
The site will work either way, it's just a matter of how it shows up in the URL bar (and how search engines and cookies treat it, etc). I'm agnostic as to which way is better, I just think it should be standardized. You probably don't even notice the sites that put it on automatically for you, only the misconfigured sites that don't allow the "www." at all.

I'm with you there, having one canonical address is a must. And though I might survive having "www." pasted in front of the sleek and elegant lifein19x19 I just typed into the address bar, I'd like it better without.

So it's the misconfigured sites forcing me to add the "www." which drive me mad.

*twitch*

Mad... maaad... MAAAD.... !!! :mrgreen:

Author:  kirkmc [ Fri Apr 23, 2010 9:09 am ]
Post subject:  Re: Canonical URL via modrewrite

fwiffo wrote:
I don't care which version we use, we just need to pick one. I've actually been having DNS issues with the www version, weirdly enough, so I guess I favor the shorter version...


Hmm, I don't see that we "need" to pick one; both work, and it's a pretty standard "hack" for websites. I do it on all mine. If there's a DNS issue, that'd be somewhat odd - no one else has posted about DNS issues for the URL.

Author:  ross [ Fri Apr 23, 2010 9:17 am ]
Post subject:  Re: Canonical URL via modrewrite

kirkmc wrote:
Hmm, I don't see that we "need" to pick one; both work, and it's a pretty standard "hack" for websites. I do it on all mine. If there's a DNS issue, that'd be somewhat odd - no one else has posted about DNS issues for the URL.

By "pick one" we mean standardize on one to 301-redirect the others to (for aforementioned SEO, cookie, etc. issues).

Author:  xed_over [ Fri Apr 23, 2010 9:17 am ]
Post subject:  Re: Canonical URL via modrewrite

kirkmc wrote:
Hmm, I don't see that we "need" to pick one; both work,

Yes we do, Ross is right.

But not "we" (public), "we" (site owners/admins). It will be practically invisible to we-public.

Because of tracking cookies and such, there needs to be only one site. All others should redirect to it.

Author:  unkx80 [ Fri Apr 23, 2010 10:29 am ]
Post subject:  Re: Canonical URL via modrewrite

Yes, better to just redirect the www. version to the version without www. (or the other way round). Then people and search engines will see and bookmark only one version.

Author:  xed_over [ Tue Apr 27, 2010 10:06 am ]
Post subject:  Re: Canonical URL via modrewrite

people are still having trouble with this issue. what's the status?

Author:  Jordus [ Tue Apr 27, 2010 11:46 am ]
Post subject:  Re: Canonical URL via modrewrite

We think we have found the problem. We will try fixing soon during a period of low traffic.

Author:  ross [ Tue Apr 27, 2010 4:14 pm ]
Post subject:  Re: Canonical URL via modrewrite

Jordus wrote:
We think we have found the problem. We will try fixing soon during a period of low traffic.

Ummmm... did you find that you need to have a canonical URL, and you're going to use modrewrite to do a 301 redirect? :mrgreen: Or are you attempting some other solution?

Author:  Jordus [ Tue Apr 27, 2010 4:17 pm ]
Post subject:  Re: Canonical URL via modrewrite

ross wrote:
Jordus wrote:
We think we have found the problem. We will try fixing soon during a period of low traffic.

Ummmm... did you find that you need to have a canonical URL, and you're going to use modrewrite to do a 301 redirect? :mrgreen: Or are you attempting some other solution?


Originally I came across this on a phpbb3 site:

Quote:
I would suggest you set your cookie domain in phpbb and all products to this

.domain.com

reason being if someone clicks some link and there is not a www in it or say they login in phpbb without the www the cookie is not recognized on www or vice versa with no www depending on how they login. with a cookie domain of .domain.com your users will be logged in continuously nomatter the subdomain.

Also if logging in through PHPBB make sure they click the remember me button to create a cookie since our products work with cookies not sessions.
\

However fwiffo pointed out the mod rewrite should be done too for other reasons. So we are going to try the modrewrite first.

Author:  Jordus [ Wed Apr 28, 2010 8:25 pm ]
Post subject:  Re: Canonical URL via modrewrite

Added the mod rewrite and changed cookie info. works for me. Anybody else?

Hint: be sure to clear cookies and restart browser first.

Author:  ross [ Wed Apr 28, 2010 9:03 pm ]
Post subject:  Re: Canonical URL via modrewrite

Jordus wrote:
Added the mod rewrite and changed cookie info. works for me. Anybody else?

Hint: be sure to clear cookies and restart browser first.

Doesn't work for me. I can still access both lifein19x19.com and www.lifein19x19.com and be logged in on one but not the other. In fact, I can't even log into www.lifein19x19.com any more—I can only log into lifein19x19.com. If I try to log into the www version, it just redirects me back to the login page.

Author:  Jordus [ Wed Apr 28, 2010 9:06 pm ]
Post subject:  Re: Canonical URL via modrewrite

ross wrote:
Jordus wrote:
Added the mod rewrite and changed cookie info. works for me. Anybody else?

Hint: be sure to clear cookies and restart browser first.

Doesn't work for me. I can still access both lifein19x19.com and http://www.lifein19x19.com and be logged in on one but not the other. In fact, I can't even log into http://www.lifein19x19.com any more—I can only log into lifein19x19.com. If I try to log into the www version, it just redirects me back to the login page.



Cookies issue. should be fixed. clear cache restart browser.

Author:  xed_over [ Wed Apr 28, 2010 9:09 pm ]
Post subject:  Re: Canonical URL via modrewrite

ross wrote:
In fact, I can't even log into http://www.lifein19x19.com any more—I can only log into lifein19x19.com. If I try to log into the www version, it just redirects me back to the login page.

I can't login either ... it redirects back to login screen -- but if I click the board index page before it redirects, then I can get in.

edit: problem with nested quotes

Author:  Jordus [ Wed Apr 28, 2010 9:10 pm ]
Post subject:  Re: Canonical URL via modrewrite

mod rewrite didnt work.

cookie settings change did,

however cookie settings change caused the login problem for some users.

back to the drawing board.

Author:  Jordus [ Wed Apr 28, 2010 10:07 pm ]
Post subject:  Re: Canonical URL via modrewrite

gave it another try. there doesnt seem to be a login issue so far....

Page 1 of 2 All times are UTC - 8 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/