Site wide 301 or canonical links.
-
Hi guys, I'd like add code to my header file to specify www. as opposed to just http:// for the canonical links across my entire site. How can I do this? I'd like it to be site wide code that I can just add to my header.php file which is included across the site.
-
Thanks Shane,
That was exactly what I was looking for!
-
Hi,
I believe what you are looking for is
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain.com [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]
If I read the post correctly as adding a sitewide canonical in header.php would not work, unless you actually programmed a php statement that all it did was add www, but this would only be a backup, if I was unable to do 301 in my opinion
Shane
-
Sorry I should have added I don't know the symbols to use to equate to any page starting with http:// should be fwd'ed to same page but http://www.
-
Hi Lodovico, thanks for your reply. I am fine with that, but do you know how I'd have to write the 301 in my .htaccess file to 301 every http://xxxxx.com page to http://www.xxxxx.com ?
-
Since the result you want is site wide, I would use a 301 redirect.
It's more radical, but you won't depend on the right header file to be included in all pages (i.e. you will be able to use different files, if you ever need it - e.g. to set up a landing page or mini site with its own template).
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
Nofollow on internal links
Hi, What do you all think about using nofollow on internal links? On pages that arent so important and use dofollow on important pages maybe for example from the sites menu.
On-Page Optimization | | Rob-0 -
Long url links
Just wondering about creating links.
On-Page Optimization | | Robotnik
Is it ok to have very long links?
Like: http://www.robotnik.com/computer-hardware-ram/8gb-ddr3-1600-desktop Is the above too long, is it better for SEO to be more to the point? Also For better SEO, is it better to use hyphens in a domain name or not?0 -
How do I remove a Canonical URL Tag?
Some of my report cards say I have too many canonical URL tags. However, there is no information no how to delete one. Can someone give me a link or explain? Thanks.
On-Page Optimization | | dealblogger0 -
How to handle lots of outbound links
I decided to create a page on my website where I would list all of my favorite resources and 3rd party tools. There are now 35 links in the main content section of the page, all with anchor text, pointing to websites in my industry. My question is this: what is the best practice here? Should I add nofollow tags to the links? Should I do something else to indicate that these links shouldn't be crawled? Frankly, I don't mind passing some link juice to these tools (in this case, and from this particular website), but I might make a different decision with a client's website. Does anyone have any thoughts on this? Here is the page I'm referring to, in case anyone wants to look: http://willmarlow.com/resources-2/the-digital-marketing-toolbox/. Thanks!
On-Page Optimization | | williammarlow0 -
How to add canonical tag
Hi, I read through many of the forum questions dealing with the overly dynamic URLS and I think I understand. Please let me know if I know what I am talking about: If SEO moz is saying I have 20 pages (mostly search and home/index pages) with overly dynamic urls, I would go to the that particular page and add the following code between the head tag: This code would cause Google to go to this page instead of the following duplicate index pages: 1. http://www.about-sports-collectibles.com/index.php?pcsid=0a83aa7119cf3d80a1d018634ec4ec94&p 2. http://www.about-sports-collectibles.com/index.php?pcsid=18b220fc62628b013a51c6f26209df50&p There are a total of about 8 of these index pages. The problem is that I can't figure out where I would access each of these duplicate pages to add the canonical tag. There is only one home page with coding. As far as the search pages are concerned, I would not want Google to follow those pages would I? If that is the case, what would be the best code to add between the tags? For instance here are a couple of the overly-dynamic URL pages for the search pages: 1. http://www.about-sports-collectibles.com/index.php?p=catalog&mode=search&search_in=all&search_str= 2. http://www.about-sports-collectibles.com/index.php?pcsid=50354d5791e627dc2be6c86528154a5e&p=catalog&mode=search I hope I am not overwhelming anyone with my questions. I really am trying to get a handle on how Ll this stuff works. Thanks so much the help. Don
On-Page Optimization | | ge01734001 -
Too many on page links
I'm having trouble interpreting this data. It says several of my blog pages have too many on page links, some as high as 140 and there is no example of a blog post that they are referring to. What am I missing? I never post more than a handful (5-7) in our 600-1000wd blogs. When I drill down, it doesn't give me very much information except "Found over 41 years ago" off to the right. When I click on the "too many on page links" URL, it provides a long list of website pages that are renamed with the blog name. huh? A lot of this stuff isn't very intuitive, SEOMoz.
On-Page Optimization | | amandahx20 -
How would you handle network header links?
Some companies have a lot of sites covering various topics, for example, http://ninemsn.com.au/. Each category also have dropdown menus where there are more links, taking their pages to well over 100 links. Should these headers be implemented in javascript? Is there a list of best practices somewhere when dealing with a lot of network sites? I'd prefer to reduce the number of links, but sometimes company policies don't allow this. Any suggestions or tips would be helpful.
On-Page Optimization | | bigpond0 -
Site wide internal links in footer
What is your take on site wide inernal links in the footer, e.g. for the most competitive keywords? Do you think those links are still useful or are those links of little value from your experience? It is an old school tactic but I still see many sites doing it.
On-Page Optimization | | Florakel0