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
-
We´re in trouble with our on site internal link optimization - please help
Dear Moz community, We have made a great mistake. Looking at keyword search volumes somehow Moz showed volumes for two keywords which only differentiate by an '**s (plural) as same. **Now we optimized our internal links (all links have the keyword) for the singular word. Now looking at other search volume estimations from competitors we see, that the plural has 5 times bigger volume. Our issue: If we change some of the category links now to another keyword, we will loose our ranking with the singular word. Correct? If we do not change any of our internal links, we will never rank in top 6 with the keyword. (currently singular is 6 and plural is 15) What would you reccomend?
On-Page Optimization | | advertisingcloud0 -
Duplicate ecommerce domains and canonical
Hi everybody! I'd like to discuss the SEO strategy I've thought regarding a client of mine and ask for help because it's a serious case of duplicate content. There is a main website (the business model one) where he compares the cost of medicines in several pharmacies, to show the cheapest shopping cart to the customer. But the shopping has to been made in another domain, within the selected pharmacie, because my country's law in Europe says that is compulsory to sell the medicines only on the pharmacy website. So my client has started to create domains, one for each pharmacy, where the differences between them are only some products, the business information of the pharmacy and the template's colour. But all of them shares the same product data base. My aim is to rank the comparing website (it contains all the products), not each pharmacy, so I've started to create different content for this one. Should I place rel=canonical in the pharmacies domains t the original one? For instance: www.pharmacie1.com >> www.originaltorank.com www.pharmacie2.com >> www.originaltorank.com www.pharmacie1.com/product-10 >> www.originaltorank.com/product-10 I've already discuss the possibilities to focus all the content in only one website, but it's compulsory to have different domains in order to sell medicines By the way, I can't redirect 301 because I need these websites exist for the same reason (the law) He is creating 1-3 new domains every week so obviously he has had a drop in his SEO traffic that I have to solve this fast. Do you think the canonical will be the best solution? I dont want to noindex these domains beacuse we're creating Google Local pages for each one in order to be found in their villages. Please, I'll appreciate any piece of advice. Thanks!
On-Page Optimization | | Estherpuntu0 -
Unsure about improvement of inner sites
Hi ! I want to improve the ranking of Home on my site. Now I did some on-page SEO on Home itself for the keyword "Webdesign Freiburg". How much does it make sense to put this keyword also into inner sites - although I primarily want to rank Home for this keyword? Does Home profit from putting the keyword into subpages? Cheers and thanks Marc
On-Page Optimization | | RWW0 -
On page links
Hi I am really intrigued by Bloomberg strategy. if you look at their article pages they are full with internal links done with what I assume to be an automated process (too many pages to be done manually). it seems to work for them. I would love to hear your opinions.
On-Page Optimization | | ciznerguy
http://www.bloomberg.com/news/2014-11-26/uber-said-close-to-raising-funding-at-up-to-40b-value.html0 -
Appropriate Use of Rel Canonical
I have encountered problems regarding rel canonical. When I ran On-Page Report Card it says **Error: ** Appropriate Use of Rel Canonical Canonical URL: "http://www.sourcedental.createmyid.net/teeth-whitening/" Explanation: If the canonical tag is pointing to a different URL, engines will not count this page as the reference resource and thus, it won't have an opportunity to rank. Make sure you're targeting the right page (if this isn't it, you can reset the target above) and then change the canonical tag to reference that URL. Recommendation We check to make sure that IF you use canonical URL tags, it points to the right page. If the canonical tag points to a different URL, engines will not count this page as the reference resource and thus, it won't have an opportunity to rank. If you've not made this page the rel=canonical target, change the reference to this URL. NOTE: For pages not employing canonical URL tags, this factor does not apply." I just don't know how to fix this. I am using Wordpress SEO by Yoast but I haven't change any settings regarding rel canonical. Can anyone help me with this? Thanks
On-Page Optimization | | projectassistant0 -
Impact of nofollow links
Does anyone know what the impact of a nofollowed link is on the ranking value any given page has to distribute? For example, if I have 2 links on a page, both followed, I know those links each distribute nearly 50% of the total ranking value the current page has to offer. However, if one of those links is nofollowed, does that automatically mean the other link gets the ranking value cast off by the nofollowed link? In other words, the single followed link now distributes nearly 100% of the ranking value the page has to offer? It seems to me I remember hearing this was not the case and that the ranking value a nofollowed link would have if it were followed just evaporates. This would mean the single followed link still only passes on around 50%...not 100%. Is the effect different if the links are internal vs. external? If any citations are available to justify knowledge here, that would be great. I know a lot of people have opinions about this subject, but I'm not sure anyone knows Google's position. Thanks!
On-Page Optimization | | RyanOD0 -
Site Wide Title Tag Discussion
Do you think it's good to have an instance of your primary keyword occur on most of your site's title tags throughout your site? Or do you think having the keyword occur in most title tags throughout the site will dilute the ranking ability for the home page? I haven't read much about this in "best practices" for title tags. hmmmm...
On-Page Optimization | | Joes_Ideas0 -
Canonical Tag for Ecommerce Site
My client has an ecommerce site with over 1,000 products. We have a ton of duplicates because of how their ecommerce system handles product pages. Each time a new product is added, there is a default product page created (/product/12345-product-name.aspx). Each time that product is added to a specific product category, another, separate URL is created (/product/office-chairs/12345-product-name.aspx). The site has over 1,000 duplicates (at least one for each product) because of how the ecommerce system structures URLs. We are unable to have unique content on /products/12345-product-name.aspx and /product/office-chairs/12345-product-name.aspx because both pages pull from the same database. Their webteam informed me that they can't implement canonical tags on individual pages, they must be dynamically added to the site all at once. Thus forcing me to choose all of the default product pages as primary URLs. Both types of URLs are getting indexed and the product URLs that were added to the categories are SEO friendly so I'm leary to eliminate one or the other with a canonical tag or a no index. Suggestions?
On-Page Optimization | | DynoSaur0