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
-
SEO for E-Commerce Sites
Hi Everybody, I have two e-commerce sites just launched with not much content at the moment just user login pages for the clients to avail the service. The management is not interested to put much content there i think. Maximum what they will be putting only 5 pages of content in total, not more than this. Any practical tips how to optimize such sites especially when there is not much content. Best
On-Page Optimization | | Sequelmed0 -
Two sites into one
I have two sites owned by one client, he wants to merge them into one keeping one website, but which one? I've been using the Moz Pro to look at the stats for both sites; page authority, inbound links etc, but they're both fairly close in results. The client wants to know what would be the best course to take with these two sites, what site should he keep and which should he merge? Any advice?
On-Page Optimization | | barrowr0 -
The correct way to go from PHP site to HTML site?
I have a website fully coded in PHP and I am doing a re-design over to an HTML site. I searched through the Q&A and there were some conflicting answers. Some said you will need to 301 all the pages. Others said to use the .htaccess to parse all the files as html. What is the correct way I should go about this? Thanks in advance!
On-Page Optimization | | reliabox0 -
Anyone know of a tool to monitor site for outgoing links?
Is there any type of tool that can monitor a large website's outgoing links? I'm dealing with a huge site and was hoping there was something available that could check outgoing links without having to go through each page manually. (I'm looking to remove anything that links to a bad neighborhood). Thanks.
On-Page Optimization | | cakelady0 -
Links in header tags
Hello Seomozzers I have a query, is it good to have links in h2, h3, h4 tags. Does it have a positive factor over on page optimisation or a negative factor. Thanks
On-Page Optimization | | usef4u0 -
Page Shaping - No Follow Links
It's my understanding that adding a nofollow tag to pages that aren't of significance to users can help with page shaping and directing google to the most important links on my home page. I have 4 links on my home page that I'm considering adding a nofollow tag to: Privacy Policy, Legal Policy, Anti-Trust Policy, and Help-Desk Because these links are in the footer on every page I think they're probably sucking up some useful link juice. It's doubtful that anyone would actually search for our privacy policy or legal policy to find our site. I'd rather the juice to spread to other pages of use. What do you guys recommend?
On-Page Optimization | | inhouseninja0 -
Too Many On-Page Links
Hi All, New to SEOMoz, so thanks in advance for any answers! Looking at our Crawl Diagnostics and "Too Many On-Page Links" is first on the list. The site was build with the intention of users being able to quickly get to where they want to go with drop down menus (sub nav), so we built the navigation using bullet points/css. Yes, agreed there are too many links on each page from our navigation, main nav cats are 4 with sub nav about 40, but what is the best way to resolve the problem other then removing most of the links (from the sub nav drop down)? Could we just use the attribute rel=nofollow for the sub nav links? TIA
On-Page Optimization | | bmmedia0 -
Site wide internal links in footer
What is your take on site wide inernal links in the footer, e.g. for the most competitive keywords? Do you think those links are still useful or are those links of little value from your experience? It is an old school tactic but I still see many sites doing it.
On-Page Optimization | | Florakel0