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
-
What are the Best On-Site SEO Practices before an E-commerce Site Goes Live?
Hello, I’m working on a client’s E-commerce website. This website is not live yet. Before the site goes live, I am curious to know what the best practices of On-site SEO are. Please let me know from which factor should I start analyze? Thanks.
On-Page Optimization | | TopLeagueTechnologies0 -
Ref = Canonical
Does it make sense to use the Canonical statement on pages on your web site that already have the correct URL. Or, should I ask, "Does it do any harm?"
On-Page Optimization | | JustInsulation0 -
Changing my site (dramatically)
I am about to do a complete site change. I am going to WordPress. I am ranked #2 on SERPS. Will I lose rank for changing everything on my site? I have 500 pages indexed but I am about to have 30k indexed. It is a real estate site that is switching from a "framed" solution, to a listing indexed solution. If I make good use of my keywords etc (on site optimization) will I be at risk of losing risk just for changing my site?
On-Page Optimization | | JML11790 -
Do NoFollow links still split link equity?
So I realize that Google will split link equity between all links on any given page. Example, if a landing page has 10 links then the authority from the landing page is split into 10 and each link given its own smaller amount of equity from that landing page. My question is if I were to turn 9 of the 10 links on this page to NoFollow links would the equity still remain split 10 ways or would it simply pass all of it to the one DoFollow link left on the page?
On-Page Optimization | | PageOnePowerGang0 -
Seasonal site structure
Bit of a complicated one for anyone who likes a challenge.. We sell a range of products which are very seasonal, so therefore have a seasonal section within the store with the products categorized into their relevant categories. In additon to this i wanted to also create a feature of each season so in effect pull forward on to a new tab the relevant season ie: Valentine so that customers didn't have to hunt for the products by going via seasonal shop etc The problem is that my site urls display last-category/product-title so in effect as the seasons change these urls will be deleted. They do remain elsewhere in our catalogue.. Does this make sense?
On-Page Optimization | | LadyApollo0 -
product links
If you sell a range of products say 3 at the most, all on their own pages, is it ok to link to the other products within the range from each page? I have tried this and it eventually leads back to the same page is this a good, bad or doesn't really matter thing? Also is the anchor text still important?
On-Page Optimization | | LadyApollo0 -
Navigation Links in Footer
What are your thoughts about navigation links in the footer? For example: www.chasepaymentech.com - good, bad, or indifferent for SEO?
On-Page Optimization | | kasi0 -
Where does link juice flow on a cloaked link?
Hello, I use a wordpress plug in that allows me to display tot he user any link I want from my domain, so it might be like: www.domain.com/gift-card, but the actual link is www.someaffiliatelink/w09fjai;owfoienw <--- and then a bunch of crap after the domain for the affiliate link. It uses the common technique of an iframe to hide the actual url from the user and show the one that I want them to see. What I am wondering is, does link juice in this case flow to my site, or to their site? And also, do you have any comments regarding this type of link cloaking? Thanks. Thanks
On-Page Optimization | | BigJohnson0