It is currently Fri May 16, 2025 2:36 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 22 posts ]  Go to page 1, 2  Next
Author Message
Offline
 Post subject: Canonical URL via modrewrite
Post #1 Posted: Fri Apr 23, 2010 8:29 am 
Dies with sente
User avatar

Posts: 92
Location: シアトル
Liked others: 24
Was liked: 36
Rank: DGS 9k
GD Posts: 1315
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!

Top
 Profile  
 
Offline
 Post subject: Re: Canonical URL via modrewrite
Post #2 Posted: Fri Apr 23, 2010 8:40 am 
Dies with sente
User avatar

Posts: 106
Location: Germany
Liked others: 64
Was liked: 7
Rank: EGF 8k
Universal go server handle: ChradH
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.

_________________
To sig or not to sig, that is the question.

Top
 Profile  
 
Offline
 Post subject: Re: Canonical URL via modrewrite
Post #3 Posted: Fri Apr 23, 2010 8:42 am 
Gosei
User avatar

Posts: 2060
Location: Texas
Liked others: 546
Was liked: 173
Rank: KGS 3k
GD Posts: 264
KGS: Chew
He/they are making it so that you do NOT have to add the www. Fear not =)

_________________
Someday I want to be strong enough to earn KGS[-].

Top
 Profile  
 
Offline
 Post subject: Re: Canonical URL via modrewrite
Post #4 Posted: Fri Apr 23, 2010 8:45 am 
Dies with sente
User avatar

Posts: 92
Location: シアトル
Liked others: 24
Was liked: 36
Rank: DGS 9k
GD Posts: 1315
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.

Top
 Profile  
 
Offline
 Post subject: Re: Canonical URL via modrewrite
Post #5 Posted: Fri Apr 23, 2010 8:57 am 
Gosei
User avatar

Posts: 1435
Location: California
Liked others: 53
Was liked: 171
Rank: Out of practice
GD Posts: 1104
KGS: fwiffo
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...

_________________
KGS 4 kyu - Game Archive - Keyboard Otaku

Top
 Profile  
 
Offline
 Post subject: Re: Canonical URL via modrewrite
Post #6 Posted: Fri Apr 23, 2010 8:58 am 
Dies with sente
User avatar

Posts: 106
Location: Germany
Liked others: 64
Was liked: 7
Rank: EGF 8k
Universal go server handle: ChradH
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:

_________________
To sig or not to sig, that is the question.

Top
 Profile  
 
Offline
 Post subject: Re: Canonical URL via modrewrite
Post #7 Posted: Fri Apr 23, 2010 9:09 am 
Lives in sente
User avatar

Posts: 1072
Location: Stratford-upon-Avon, England
Liked others: 33
Was liked: 72
Rank: 5K KGS
GD Posts: 1165
KGS: Dogen
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.

_________________
My blog about Macs and more: Kirkville

Top
 Profile  
 
Offline
 Post subject: Re: Canonical URL via modrewrite
Post #8 Posted: Fri Apr 23, 2010 9:17 am 
Dies with sente
User avatar

Posts: 92
Location: シアトル
Liked others: 24
Was liked: 36
Rank: DGS 9k
GD Posts: 1315
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).

Top
 Profile  
 
Offline
 Post subject: Re: Canonical URL via modrewrite
Post #9 Posted: Fri Apr 23, 2010 9:17 am 
Oza

Posts: 2264
Liked others: 1180
Was liked: 553
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.

Top
 Profile  
 
Offline
 Post subject: Re: Canonical URL via modrewrite
Post #10 Posted: Fri Apr 23, 2010 10:29 am 
Lives with ko

Posts: 257
Location: Singapore
Liked others: 13
Was liked: 30
Rank: Dan player
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.

_________________
My homepages: http://senseis.xmp.net/?Unkx80 and http://yeefan.sg/.

Top
 Profile  
 
Offline
 Post subject: Re: Canonical URL via modrewrite
Post #11 Posted: Tue Apr 27, 2010 10:06 am 
Oza

Posts: 2264
Liked others: 1180
Was liked: 553
people are still having trouble with this issue. what's the status?

Top
 Profile  
 
Offline
 Post subject: Re: Canonical URL via modrewrite
Post #12 Posted: Tue Apr 27, 2010 11:46 am 
Site Admin
User avatar

Posts: 1125
Location: Allegan, MI, USA
Liked others: 18
Was liked: 121
Rank: KGS 9k
Universal go server handle: Jordus
We think we have found the problem. We will try fixing soon during a period of low traffic.

_________________
I'm thinking...

Top
 Profile  
 
Offline
 Post subject: Re: Canonical URL via modrewrite
Post #13 Posted: Tue Apr 27, 2010 4:14 pm 
Dies with sente
User avatar

Posts: 92
Location: シアトル
Liked others: 24
Was liked: 36
Rank: DGS 9k
GD Posts: 1315
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?

Top
 Profile  
 
Offline
 Post subject: Re: Canonical URL via modrewrite
Post #14 Posted: Tue Apr 27, 2010 4:17 pm 
Site Admin
User avatar

Posts: 1125
Location: Allegan, MI, USA
Liked others: 18
Was liked: 121
Rank: KGS 9k
Universal go server handle: Jordus
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.

_________________
I'm thinking...

Top
 Profile  
 
Offline
 Post subject: Re: Canonical URL via modrewrite
Post #15 Posted: Wed Apr 28, 2010 8:25 pm 
Site Admin
User avatar

Posts: 1125
Location: Allegan, MI, USA
Liked others: 18
Was liked: 121
Rank: KGS 9k
Universal go server handle: Jordus
Added the mod rewrite and changed cookie info. works for me. Anybody else?

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

_________________
I'm thinking...

Top
 Profile  
 
Offline
 Post subject: Re: Canonical URL via modrewrite
Post #16 Posted: Wed Apr 28, 2010 9:03 pm 
Dies with sente
User avatar

Posts: 92
Location: シアトル
Liked others: 24
Was liked: 36
Rank: DGS 9k
GD Posts: 1315
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.

Top
 Profile  
 
Offline
 Post subject: Re: Canonical URL via modrewrite
Post #17 Posted: Wed Apr 28, 2010 9:06 pm 
Site Admin
User avatar

Posts: 1125
Location: Allegan, MI, USA
Liked others: 18
Was liked: 121
Rank: KGS 9k
Universal go server handle: Jordus
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.

_________________
I'm thinking...

Top
 Profile  
 
Offline
 Post subject: Re: Canonical URL via modrewrite
Post #18 Posted: Wed Apr 28, 2010 9:09 pm 
Oza

Posts: 2264
Liked others: 1180
Was liked: 553
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

Top
 Profile  
 
Offline
 Post subject: Re: Canonical URL via modrewrite
Post #19 Posted: Wed Apr 28, 2010 9:10 pm 
Site Admin
User avatar

Posts: 1125
Location: Allegan, MI, USA
Liked others: 18
Was liked: 121
Rank: KGS 9k
Universal go server handle: Jordus
mod rewrite didnt work.

cookie settings change did,

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

back to the drawing board.

_________________
I'm thinking...

Top
 Profile  
 
Offline
 Post subject: Re: Canonical URL via modrewrite
Post #20 Posted: Wed Apr 28, 2010 10:07 pm 
Site Admin
User avatar

Posts: 1125
Location: Allegan, MI, USA
Liked others: 18
Was liked: 121
Rank: KGS 9k
Universal go server handle: Jordus
gave it another try. there doesnt seem to be a login issue so far....

_________________
I'm thinking...

Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 22 posts ]  Go to page 1, 2  Next

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group