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
-
urmiawebseo site urmia
Re: Star snippet not work
On-Page Optimization | | gercaarre3
Hello I write a json script for star snippet in my website but not work in my any page. can see it in this address https://www.urmiawebseo.com when I googled my keyword "طراحی سایت در ارومیه" my site dont show. #on_page0 -
Internal Links Catalog (too many links)
I have several car catalogs that I use to direct my customers to the parts for their vehicle. Example:http://www.mikesfuel.com/Acura_c_69.html My customers like the approach. They can easily find their vehicle, then scan the columns for the parts that they need. Each part number is a link and the part numbers are sometimes posted several times in one column. All of the links are internal to the web site. My fear is that this is going to be treated as a link farm. I have considered using a PDF catalog with links, but that is going to be hugely expensive. What do you think? Thanks for any help Mike
On-Page Optimization | | mikescarb0 -
Internal links are not indexed of the website
Some internal links are indexed and some not of the same page of the website, what is the so and what is the reason behind?
On-Page Optimization | | renukishor10 -
On Site Errors
HI Folks I'm monitoring a small Australian site bluetea.com.au . Currently I have a SEO specialist who does month onsite maintenance work for this site. However each month I continue to see errors in webmaster tools... as an example, currently webmaster tools suggest we have 21 short meta dic and 26 duplicate title tags..... Examples given are Short Meta Discp /cleaning-products-and-our-health/toxic-cleaners/ /colour-consultant/fushia-door/ /portfolio/parisian-apartment-black-kitchen/parisian-apartment-black-kitchen/ Duplicate title tags <a id="zip_0-anchor" class="zippedsection_title"></a>concrete-kitchen | Blue Tea Kitchen Designs /kitchen-trends-and-material-innovation/concrete-kitchen-2//kitchen-trends-for-2013/concrete-kitchen/<a id="zip_1-anchor" class="zippedsection_title"></a>Potts Point Kitchen | Blue Tea Kitchen Designs/portfolio/potts-point-kitchen//portfolio/potts-point-kitchen/pott-point-kitchen/My SEO tells me that he has solved all these issues but after one or two months they still remain in webmaster tools... can anybody help me understand why?Thank you
On-Page Optimization | | PHD0 -
Internal and Link Juice Analysis - Too Many Links Error
Howdy! I have an analysis question related to internal links/link juice. Here is the general link set up of our site: 1. All Site Pages (Including Home Page): We have drop down "mega" menus in the header of everypage linking to various sub-categories on the site. So, because of this, in our header, we have a few hundred links to various pages on our site and these show up on every page of the site. 2. Product Pages: Header pages as mentioned above, but on top of that, we list out the keywords for that particular product and each keyword is linked back to our search results pages for that particular keyword. In General Moz is telling us we are having between 200-300 links on each product page. Currently, our Search Results pages are ranking higher and showing up in search more than our actual product pages. So, based on the above info, here are some thoughts: 1. Should we ajax in the Header links so that they aren't showing up for the search engines? Or, should we ajax them in only on all pages that are not the Home Page? 2. Should we get rid of the keyword links back to the Search Results pages that are on the product pages? What effect would these changes "actually" have? Does this just improve crawling? Or are there other positive results that would come of changes like these? We have hundreds of thousands of products, so if we were to make changes like these, could we experience negative results? Thanks for your help! Craig
On-Page Optimization | | TheCraig0 -
Too many links on page -- how to fix
We are getting reports that there are too many links on most of the pages in one of the sites we manage. Not just a few too many... 275 (versus <100 that is the target). The entire site is built with a very heavy global navigation, which contains a lot of links -- so while the users don't see all of that, Google does. Short of re-architecting the site, can you suggest ways to provide site navigation that don't violate this rule?
On-Page Optimization | | novellseo2 -
Appropriate Use of Rel Canonical
Hello, in on page report card , for a kyeword: armadi portafucili blindati URL: http://www.bighunter.net/shop/searchresult.seam?codiceSettoreSel=CACCIA&codiceCategoriaSel=Armadi Blindati&codiceSottoCategoriaSel=Linea Legno DeLuxe&codiceMarcaSel=SILMEC i have a Critical Factor that don't undestand. It 's not ok "appropiate Use of Rel Canoncal, but in my page i have <link href="http://www.bighunter.net/shop/searchresult.seam?codiceSettoreSel=CACCIA&codiceCategoriaSel=Armadi Blindati&codiceSottoCategoriaSel=Linea Legno DeLuxe&codiceMarcaSel=SILMEC" rel="canonical"> and the link is the same of the url . I don't undestand where is the problem . Who can help me? Best Regards Luca
On-Page Optimization | | lbecarelli0 -
Canonical to the page itself?
Hello, I'd like to know what happens when you use canonical to the same page itself, like: Page "example.com" rel canonical="example.com" Does that impact in something? Bad or good? See ya!
On-Page Optimization | | seomasterbrasil1