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 is the Impact of Canonical to a Canonical Page?
hey folks, How does google respond to this, canonical to a canonical page? i.e page A is canonical to Page which is already/also canonical to PAGE C. Thanks In advance AK
On-Page Optimization | | AnkammaRao0 -
Why Does This Site Rank Well?
I noticed recently that the website of a local church (http://www.lifepointfc.com/) has climbed toward the top of the SERPS, and I cannot figure out why. The on-site SEO seems mediocre, at best, and their domain authority is 15 while their homepage authority is just 19. Does anyone see how they are working their SEO magic?
On-Page Optimization | | cbizzle0 -
Rel="canonical" link should they be to or from an "SEO friendly" url
Thanks for taking the time to review this. So for our example, lets use the following SEO friendly link: http://hiu.calibermediagroup.com/undergraduate-on-campus/academics/colleges/pacific-christian-college-of-ministry-and-biblical-studies/BA-biblical-studies We'll call this link the SEO VERSION The title of the college is" Pacific Christian College of Minstry and Biblical Studies" The title of the program is "BA Biblical Studies" The QUERY version of the link to this page would be something like: http://hiu.calibermediagroup.com/undergraduate-on-campus/academics/colleges/index.php?collegeid=22&programid=34 Keep in mind that the meta title, description, and keyword tags for the page are all administerable The SEO VERSION is automatically created from the title of the college, and the title of the program. Each one of these titles can be overidden with a URL slug individually. For instance, the admin could make the link: http://hiu.calibermediagroup.com/undergraduate-on-campus/academics/colleges/pacific-christian-college-of-ministry/biblical-studies by changing the slug for the college to "pacific-christian-college-of-ministry" and the slug for the program to "biblical-studies". Let's call this version the SLUG VERSION So now we have multiple ways to get to the same content. The question on the table is what is best practice for the rel="canonical" link to keep from getting dinged for duplicate content. Let's say that our SEO VERSION is the canonical link for 1 year. Then the choice was made to optimize the links thru the slugs creating the SLUG VERSION. My assumption is that we would keep the SEO VERSION as the canonical link. But then let's say 6 months later that the title of the program is changed in the admin. Now the SEO VERSION has changed and so has the canonical link. Do we lose the link juice garnered over the last 18 months? It would seem to me, that if we use the QUERY version as the canonical link, then any optimizations or changes affect everything except the canonical link, thus keeping the previous link juice earned. But is having an ugly URL as the canonical link detrimental to SEO? Please advise.
On-Page Optimization | | robertdonnell0 -
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 -
Do the rules of “natural” linking apply to on-site crosslinking as well?
At an SEO conference I attended the speaker said that Google wants the anchor text of a link to be more natural. Specifically you mentioned that the anchor text should be the company brand, the domain name/URL or a call to action (ex. “Click here.”) I thought this was an interesting idea for offsite linkbuilding. BUT, my question is…Does the rule also apply for on-site crosslinking between my webpages? Is there potential harm or a benefit to adding keywords to the anchor text of the links within my site?
On-Page Optimization | | donationtown0 -
No Follow Internal Links
Hi Mozzers, I know that this has been asked a few times and answered as well, I would just like to know some more on the internal link count on a page. I ran the SEOmoz report and many of the pages on the website have more than 150+ internal links. Now, should I use the rel=nofollow tag on some pages that I feel are not important? I have a list of pages which are not important from the SEO point of view, but from the usability factors they need to be there so I cannot remove the links to them. So, would be OK to place the rel=nofollow tag on them. My whole purpose is to reduce the count of internal links on the page as seen by SE's. Now, some say that the rel=nofollow tag does not lower the link count, but it can definitely (I believe) prevent the bots time in getting to those pages, which SEOmoz report also quotes. (__When search engine spiders crawl the Internet they are limited by technology resources and are only able to crawl a certain number of links per webpage. ) So, probably I can save their time. Does anyone have any views on this, Cheers,
On-Page Optimization | | RanjeetP0 -
Navigation causing too many links
If I add pages to my site to cover major cities/towns/counties in the UK where I offer wedding bands and link them from the navigation using drop down menus/categories ( I believe this is the best option to allow users to find what they are looking for) I get a'too many links on page' flag. How can I best get around this problem?
On-Page Optimization | | SamCUK0 -
If I have too many on-page links can I reduce it with nofollow tags or do the links have to be removed?
On my site I have a top nav drop down menu but once visitors go to one particularly large subsection, that menu is repeated on the left for easier viewing. As a result, I shoot over 100 links on page. Can I put nofollow or noindex tags on the left side links and reduce my "official" on-page links count or do I have to actually eliminate some of the links? Thanks, Oak
On-Page Optimization | | CSA-2316710