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
-
301 Redirect chain
I've got a redirect chain happening
On-Page Optimization | | Libra_Photographic
http > https> https.www. I can't find how to fix this one. My site is on siteground which forces the https at server level and then onto cloudflare. Anyone have any ideas?0 -
Site folder hierarchy 2016 ?
Hi, Would you say that based only on the "folder structure" that "somedomain.com/focus-keyword" has better conditions to rank well than "otherdomain.com/general-keyword/focus-keyword" ? Using Yoast SEO for WordPress when creating automatic XML sitemaps, URLS with subfolders seems to be getting lower priority. Thanks!
On-Page Optimization | | Agguk0 -
Site wide content like "why choose us" just above the footer on every single page
Hi Guys, I know that is not good having any kind of duplicate content on your site, but SEO is above all "competition", so I have to see what my competitor are doing to find the best way to outrank them. So this is my question: is it good or not having site wide content like "why choose us" just above the footer on every single page? At the moment, I can see many - too many - of my client competitors having the "Why choose us" as site wide content above the footer. The funny thing they don't use a couple of sentences, they have placed many words and 10/20 internal links, in other words, they have enough stuff to put down a stand alone page. What do you think: this is just a bad SEO practice or it may work, as I can see so many sites ranking well with this kind of piece of junk on each page. I am not going to recommend this to my client, but as am trying to detail every decision I make showing what the competitors are currently doing, my concern is that my client finds it and therefore will ask to have the same shiny piece of garbage above the footer. Thanks, Pierpaolo
On-Page Optimization | | madcow780 -
301 Redirect to external site
Hi guys, We have a client who is getting their website redesigned through us. They are discontinuing couple of their services which will not get featured in the new site. They are fairly well ranked for these services and my client wishes to 301 redirect these pages to an external site owned by his friend so that they benefit out of the ranking. The question is: Will my client's website's general ranking get affected due to 301 redirecting to an external site? The external site is not spammy or red-flagged by Google (at the moment, at least). Thanks in advance!
On-Page Optimization | | RameshNair
Ramesh Nair0 -
Too Many On-Page Links
Hi, I did a SEOmoz campaign and got results today, One of the results is Too "Many On-Page Links" when i am drilling down, i see that that's include inside links. for example, i sale food, i have my main department window - inside i have 30 products - each product is linked to a detailed page about the product. so automatically i have 30 links - not including all the others in this page, and i easily get over 100 and even sometimes 200 is this a big issue? does it damages my SEO? If yes, is there a way to write the HTML in a way that internal links like that wont be counted? Thank you SEOWiseUs
On-Page Optimization | | iivgi0 -
Should i nofollow outgoing links on posts
Hello, on my blog i don't nofollow the outgoing links inside roundups like : http://www.designzzz.com/extreme-demos-html5-jquery/ a friend of mine suggest me to nofollow all out going links in such postings. he added that it will help increase posts PRs and better search rankings. Any thoughts? cheers
On-Page Optimization | | wickedsunny10 -
Main page link reduction
I am in the process of reducing the number of internal links from the homepage with the assumption that the more links I have the more "juice" goes to internal pages I have two options since many of the links are costumer service related 1. create one link that leads to a costumer service page and place all the links their. 2. get all those links on the main page as nofollow links. what are your opinions
On-Page Optimization | | ciznerguy0 -
Canonical URL Tag
Hi, I have two pages that are identical on my site: http://www.absolutepower.nl/creatine-monohydraat and http://www.absolutepower.nl/CREATINE/creatine-monohydraat Should I use the canonical URL tag in this case? Thanks, Jasper
On-Page Optimization | | Japking0