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 -
Do Google Know What People Are Doing On My Site?
I run an ecommerce site and am keep to increase the time on site and reduce bounce rate. I have had some good results from writing good articles and advertising them on Outbrain and Twitter; both of these metrics have improved. However, I am wondering if Google will see this. Clearly if people land on the pages from the SERPS and return there they will know what is happening but will they know if people get there from an advert?
On-Page Optimization | | T0BY0 -
Linking Out To External Sites
Hi, All If I have created a (website, logo, email campaign) for a client and written an article about it with screen shots on my website and link to them with a (do-follow) link how does Google see the (do-follow) link? Regards to the sites they have one link in the footer on the home page, which is a (do-follow) back to our site. Also, the websites are not in my Niche.
On-Page Optimization | | deskjet0 -
Broken links detected by SEOMOZ
hi there, the SEOMOZ crawl has detected two "broken links" : http://www.tarifakitesurfcamp.com/feed/
On-Page Optimization | | juanmiguelcr
http://www.tarifakitesurfcamp.com/comments/feed/ how can I fix the problem? I know that these two links are related to the user's subscription (hypothetical) to my website updates. Thanks in advanced.0 -
Canonical tags
In previous we had issues with capital letters in page urls. So we made a 301 redirection to lower case page url. But I read there that it's not good idea to use 301 redirection, better solution for that canonical tag. So we placed canonical url tak to lower case page url... So after week, in google webmaster tools I see around 60k os dublicate pages. Why google don't see canonical tag? Thank you
On-Page Optimization | | bele0 -
Too many links
Hello, sorry question 2! I run the report it says we have 120 links roughly per page. I know this is bad however I have question about an oscommerce site. I identified some links that can be deleted for example Product picture is a link then the title and then its says details (so I can delete the details and that should save about 15 links) Now I really can only delete the breadcrumb for example car>>ford>>spareparts>>engine If I delete the breadcrumb I would lose four links would you say thats a good idea? or leave the breadcrumb due to the seo benefits. Many thanks for your help. Sonja
On-Page Optimization | | reallyitsme0 -
How to solve Rel Canonical issue?
I have created one campaign for my website on SEOmoz. I found Rel Canonical issue for following 2 URLs. I can not understand that, what is error with that? Can any one help me to solve it? http://vistastores.com/blog/?p=1 http://vistastores.com/blog/?page_id=2
On-Page Optimization | | CommercePundit0 -
301 Re-directing a page
Hi, My website is appearing on page 1 of Google for a specific keyword, however when clicking on the search result, the page is out of date. As a short term solution, I have 301 redirected the url to a more up to date page on my website and beginning to optimise the on page content of this new page Is there any recommendations on what to do with the old page that appears on page 1 Google - as the page title, meta description and url displayed is out of date? Any help, best practise would be great...
On-Page Optimization | | simonsw0