Bad code on Learn Seo Redirection info Page
-
Is it just me, or is the Redirection resource page missing the exclamation point (!) in this code. If so, this could really mess someone's site up if they copy and paste.
http://www.seomoz.org/learn-seo/redirection
http://screencast.com/t/n7lknZ32G9xF
Redirecting Canonical Hostnames: The original developers at SEOmoz needed to redirect any requests that do not start with www.seomoz.org to make sure they included the www. They did this not only because it looks better, but to avoid common canonicalization errors. Redirect: http://seomoz.org/To: http://www.seomoz.org/ Redirect: http://mail.seomoz.org/To: http://www.seomoz.org Redirect: http://seomoz.org/somefile.phpTo: http://www.seomoz.org/somefile.php Solution: Add the following directive: RewriteCond %{HTTP_HOST} ^seomoz.org [NC]RewriteRule (.*) http://www.seomoz.org/$1 [L,R=301] Explanation: This directive tells apache to examine the host the visitor is accessing (in this case: seomoz.org), and if it does not equal www.seomoz.org redirect to www.seomoz.org. The exclamation point (!) in front of www.seomoz.org negates the comparison, saying “if the host IS NOT www.seomoz.org, then perform RewriteRule.” In our case RewriteRule redirects them to www.seomoz.org while preserving the exact file they were accessing in a back-reference.
*emphasis added by me
-
I think I'm becoming anal retentive. Just today, I took the time to contact two "seo" companies with linked articles from the Learn Seo page to let them know that they might want to redirect their broken links! I can't imagine having a link like that and letting it just crumble in to little 1s and 0s, not to mention I didn't get the info I was wanting. I'm sure they'll think I'm nuts. I then start thinking to myself, "self, you might know a thing or two" and then another robot and his tag issue come whack me back in my place...
thanks for the confirmation Cyrus. I just found out there's a support forum for this kind of thing..probably a better place for these issues.
-
Hi Holly,
Good catch. The code should look like:
RewriteCond %{HTTP_HOST} !^www.seomoz.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [R,L]Explanation:
This directive tells apache to examine the host the visitor is accessing. If it does not equal www.seomoz.org, redirect to www.seomoz.org. The exclamation point (!) in front of ^www.seomoz.org negates the comparison, saying “if the host IS NOT www.seomoz.org, then perform RewriteRule.” In our case RewriteRule redirects them to www.seomoz.org while preserving the exact file they were accessing in a back-reference.
I'll send a note to our help team to get this fixed.
Thanks!
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
-
No page authority for https and www versions
In Moz page onsite explorer, I'm getting a page rank of 1 for https://productcategory, and www./productcategory, but for the non-www version, I have a page rank of 33. The DA for each link is 25 Google is indexing my https:// version of my site (with the page rank of 1). Could this be why I'm getting outranked by my competitors (who have no content on their page, no links, and a lower domain and page authority than me?) Does this indicate some kind of issue with my redirections or settings in google search console? I would love to know how to fix this if it could be causing issues Thanks
Moz Pro | | Golden850 -
Hiring for SEO
so sorry if i offend anyone here ...but dang SEO Experts are the used car sale guy of 1999! we have a small eCommerce company in Jacksonville, FL - and we are always looking for improve our SEO - we have been members of moz for almost 10 years now! We have learned alot with all the tools they offer, We have tried at least 5 local and national SEO consultants, agencies and consultants - NONE HAVE WORKED. The time has come for us to hire an in house SEO do you have any advise on how a small business that wants to grow our SEO can weed thru the thousands of SEO "GURU's" out there today - Everyone is an expert. On a side not if you want to move to Florida and help us grow - www.HolmesStamp.com/team
Moz Pro | | BryanCroft1 -
Codeigniter - Controller and duplicate pages
Hi there, I use Codeigniter as framework and I have a question about the duplicate page. Actually, for default, the typical page in a CodeIgniter framework is something like this: http://www.domain.com/site/contact where site is the controller containing the contact function that point to the contact.html view... To have a better URL I use a trick with the "routes" that redirect any http://www.domain.com/contact to the original http://www.domain.com/site/contact Of course the both are valid and the both are... crawled! So I get the duplicate page. Is this something I have to manage, maybe with .htaccess? Any idea would be very appreciated. Thanks for you precious time guys! Shella
Moz Pro | | CarloShellaMascella0 -
I need an interlinking report for my site, is there a report in Moz or another application that tell me how all of my pages are linked to other pages on my site?
I am in the process of doing a redesign for one of my sites. I need an interlinking report for my site. Is there a report in Moz or another application that tell me how all of my pages are linked to other pages on my site?
Moz Pro | | seoflorida0 -
A 301 redirect to a page with a rel canonical to a page with a 301 question...
MOZ registers thousands of DC and Duplicate titles on a Drupal site which has a little strange setup. Example: www.1234.com/en-us 301 redirects to www.realsite.com/en-us which has a rel canonical to www.1234.com which 301 redirects to www.realsite.com. If you're still with me I thank you.
Moz Pro | | Crunchii
My question is since MOZ registers errors, if indeed the rel canonical isn't recognized due to a 301 redirect?0 -
Backlink of competitor inner page
How to understand from where the link to a competitor's internal page http://www.exampledomain.com/contest/book are coming? I mean, we want promote the same "event" but we want understanding where the competitor is already present. Open Site Explorer doesn't have any data for the website listed but I'm sure that the page has a lot of backlinks (I've verified the first 50 manually in Google.it) Many Thanks for all your advices.
Moz Pro | | YESdesign0 -
My Campaign only crawled 3 pages on my site
On my first crawl of a new campaign, the software only crawled 3 pages. XXXaceXXXscholarships.org any ideas?
Moz Pro | | Santaur0 -
301 Permanently Moved Redirect
After completing a crawl of my website: www.getyourphotosonchavas.com I noticed that all of the pages had a 301 Redirect? There is this huge amount of what appears to be corrupted
Moz Pro | | rdominey
data for each of these pages: Please see the attached Crawl report and a test ran from a crawl spider. It looks like each page is a 301 redirect to itself? Can anyone please tell me what all this means? 301-Redirect-crawl.jpg 301-Redirects.jpg0