Jump to content
TNG Community

URL Canonicalization


Smack

Recommended Posts

Ok - after a long absence I thought I would start working on my family history site again.

I'll post this in the feature request section as well (is there one now?), but I'd like to know if anyone is doing anything with URL canonicalization with TNG? I did a search a few minutes ago and didn't see anything.

I'm sure most people probably set up their preferences using Google Webmaster Tools, but wonder if anyone has done anything beyond this?

Also, it would be nice to be able to use the canonical link element from within TNG.

Link to comment
Share on other sites

Ok - after a long absence I thought I would start working on my family history site again.

I'll post this in the feature request section as well (is there one now?), but I'd like to know if anyone is doing anything with URL canonicalization with TNG? I did a search a few minutes ago and didn't see anything.

I'm sure most people probably set up their preferences using Google Webmaster Tools, but wonder if anyone has done anything beyond this?

Also, it would be nice to be able to use the canonical link element from within TNG.

Why should there be a change in TNG when you can simply edit your .htaccess file to do that?


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

Link to comment
Share on other sites

Why should there be a change in TNG when you can simply edit your .htaccess file to do that?


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

As many people here on the TNG Forum do not know what a .htaccess file is, it would be helpful to explain what it does, where it is located, and emphasize that htaccess file must be preceded by a dot.

Arnold

Link to comment
Share on other sites

As many people here on the TNG Forum do not know what a .htaccess file is, it would be helpful to explain what it does, where it is located, and emphasize that htaccess file must be preceded by a dot.

Arnold

ok....

The .htaccess file is a directory level configuration file found mainly on Apache webservers.

The configuration settings above with comments

#turn on Apache's rewriting module to modify URLs
RewriteEngine on

#define the condition to look for.
#In this case, we're looking to see if the host of the URL starts with "domain.tld" and doesn't have anything before that, like "www."
RewriteCond %{HTTP_HOST} ^domain\.tld [NC]                                                  

#if the criteria set by RewriteCond have been met, then this is the rule to apply
#in this case: change from "domain.tld" to "www.domain.tld" and tell the browser that it's a permanent change (code 301)
RewriteRule ^(.*)$ http://www.domain.tld/$1 [R=301,L]

Link to comment
Share on other sites

  • 5 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...