Blog subdomain not redirecting
-
Over the last few weeks I have been focused on fixing high and medium priority issues, as reported by the Moz crawler, after a recent transition to WordPress. I've made great progress, getting the high priority issues down from several hundred (various reasons, but many duplicates for things like non-www and www versions) to just five last week.
And then there's this weeks report.
For reasons I can't fathom, I am suddenly getting hundreds of duplicate content pages of the form http://blog.<domain>.com</domain> (being duplicates with the http://www.<domain>.com</domain> versions). I'm really unclear on why these suddenly appeared.
I host my own WordPress site ie WordPress.org stuff. In Options / General everything refers to http://www.<domain>.com</domain> and has done for a number of weeks. I have no idea why the blog versions of the pages have suddenly appeared.
FWIW, the non-www version of my pages still redirect to the www version, as I would expect.
I'm obviously pretty concerned by this so any pointers greatly appreciated.
Thanks.
Mark
-
So far so good - every URL I try to my site is now redirected to the www subdomain and, to date, I am unaware of any side effects. I will keep monitoring but all looks good at this point.
Thanks again to everyone who helped with this.
Mark
-
Looks like that, or some approximation thereof has you sorted. I would just like to add that you should keep an eye on Webmaster Tools.
-
Take a copy of the htaccess file, if something goes wrong, then you can always go back
-
I'm hesitant to say; "Do X." because I'm not really sure what will happen - with the redirect plugin in the mix. I imagine a lot, if not all of the subdomain folders and pages have already been redirected via the plugin. So I imagine the path of least disaster at the moment is just redirecting the subdomain (sub.domain.com) to the main domain (www.domain.com) alone.
I could be totally wrong, but this one is weird.
Test out the rule and then push live. Here is the code to redirect just the subdomain to just the www domain:
RewriteCond %{HTTP_HOST} ^blog.domain.com$ [NC]
RewriteCond %{REQUEST_URI} ^/?$
RewriteRule .* http://www.domain.com [R=301,L]Double check it, triple check it and then push live. Keep a very close eye on it. I really hope we don't end up with a loop.
-
Yep, totally agree with the thinking and prefer that approach. I researched the non-www (blank subdomain) solution a while back and the rewrite rule I used was suggested in a number of places. But your suggest seems much more robust, providing there's no gotcha (I know of none).
I implemented this and it seems to be working (after a bit of a detour because of caching :)). So, I think I am good and will monitor.
A big thanks to you and Travis. I very much appreciate the prompt responses.
Mark
-
The logic I used is like this.
rather than have a rules like
If wearing jeans, you must wear the school uniform
If wearing hoodie, you must wear the school uniform
If wearing a thong, you must wear the school uniform
If naked, you must wear the school uniformyou only need one rule
If not wearing school uniform, you must wear the school uniform -
in htaccess "!" means not so try this
RewriteCond %{HTTP_HOST} !^www.domain.com$
RewriteRule (.*) http://www.domain.com/$1 [R=301,L]also when using regex special chars like "." should be escaped with "" see above www.domain.com
-
Here's the only (remotely) relevant entry I have in my .htaccess file (replacing my actual domain with <domain>):</domain>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^<domain>.com$
RewriteRule (.*) http://www.<domain>.com/$1 [R=301,L]</domain></domain>The intent of this is to redirect all URLs of the form http://<domain>.com/page</domain> to http://www.<domain>.com/page.</domain> I implemented that a while back and it seems to be working just fine.
I can't find any reference to the blog subdomain. I suspect what I need to do is implement something like this:
RewriteCond %{HTTP_HOST} ^blog.<domain>.com$
RewriteRule (.*) http://www.<domain>.com/$1 [R=301,L]</domain></domain>By the way, despite appearances I am "the guy" for this site. I've completely installed/configured it from scratch so anything broken is my fault I have the smarts to backup, test, verify, restore etc so I can make changes to .htaccess myself. I just don't have significant experience of the .htaccess file itself so just need to be cautious as I go. But it's all me
Dare I suggest that what I am trying to achieve here (redirect from the blog subdomain to the www subdomain) shouldn't be too tricky?
Thanks.
Mark
-
Ok, I think I understand a bit better, you don't have a blog?
Then I would remove the dns record for blog, if you cant do that then yes you could 301 redirectYou can do this in one redirect following the logic
if not www.domain.com then redirect to www.domain.com -
Thanks again, Alan.
I am thinking that what I probably need is to 301 redirect all URLs of the form http://blog.<domain>.com/page</domain> to http://www.<domain>.com/page</domain>, yes? In short I don't want to use the blog subdomain anywhere so, to avoid SEO inefficiencies, I should presumably redirect as above so that everything ends up at the www subdomain.
I think
Thanks.
Mark
-
Sorry missed the bit about blog.
obviously blog.domain.com should not 301 to www
it should point to the correct site, then all reports and google will sort themselves out.so add one more step, test that blog does in fact resolve to the correct site
-
Travis,
I want to be really sure I understand what you are saying so let me clarify.
I do have a blog DNS entry, referring to the server (just like I have www, to the same IP address). In a "clean" installation, any page being requested to that server, SHOULD redirect to the www subdomain because I have www.<domain>.com</domain> specified in General \ Settings. Is that accurate so far?
However, "something" (probably in .htaccess) is kicking in that allows URLs with the blog subdomain to resolve (no redirection), regardless of what is in General \ Settings, yes?
Thanks.
Mark
-
Thanks Alan. I would like to verify one aspect of this.
Somehow, Moz/Google located the blog.<domain>.com pages. I honestly don't know why but I assume that if these pages have actual resolved all along, as they do now, then I could potentially have external URLs pointing to them, yes? If so, then if I just follow the suggestion you have made then won't I continue to have duplicate content issues? I fear I am missing something from your suggestion :)</domain>
PS: I just realized what you perhaps meant. I have generally seen references to "non-www" to mean URLs of the form http://<domain>.com</domain> ie. with no subdomain. But I am guessing you mean "non-www" in the broader sense - absolutely ANYTHING that doesn't have the www subdomain should redirect there. That's presumably what you had in mind, yes?
Thanks again.
Mark
-
This particular situation won't sort itself out. There's a sub involved and I suspect it's a rewrite rule that shouldn't be there. The developer appears to be somewhat sophisticated as they're using X-FRAME-OPTIONS in a way that doesn't allow iFrames to work outside of the domain.
So who knows what goodies await in .htaccess.
-
Test that non-www 301's to www
Make sure that all your internal links point to www, you don't want links that you control going thought a redirect.If those 2 are ok, then forget the report it will sort itself out over time.
-
Okay, here's what I got:
The plugin supposedly operates independently of .htaccess. So taking that at face value, I don't think you're going to get what you need out of the plugin.
I would imagine the .htaccess file is much the same as it was when the site launched, or when it was last modified by the developer. So that file is likely going to need editing to achieve what you need. However, that file isn't something you just want to play with in a live environment.
And it's not something anyone in their right mind would blindly say; "Yeah just copy and paste this rule!"
I would talk to Dale and see if he has a block of free time coming up.
-
We are using the Redirection plugin.
https://wordpress.org/plugins/redirection/
However, everything I have entered is at the page level (redirect page1 to page2). I don't know if the Redirection plugin even supports subdomain redirection. I am checking that now (a quick scan of the support page for that plugin finds every question related to subdomains unanswered :)).
It seems the working assumption is that nothing changed and that Moz/Google just found this for the first time, which I hadn't considered.
Thanks.
Mark
-
You are going to have to add a manual rewrite rule to the htaccess, preferably at the top. This might help, http://stackoverflow.com/questions/1321123/redirect-from-subdomain-to-domain-htaccess But like Travis said, be careful, make a back up, because you can break your site doing this.
-
You mentioned in the above thread that you're using a redirection plugin. What is it's name? Beyond that Yoast and All in One both allow you to edit htaccess entries. (I despise that feature, btw.)
-
Thank you Travis. I have never actually edited the .htaccess file directly (not even 100% sure where it is :)) but I guess what you suggest could be put there through other means (plugins, etc).
Just to make sure I understand, though, what I actually want is a 301 redirect for all pages under the blog subdomain to the www domain. I'm not overly familiar with the .htaccess syntax for redirects (but can research) - but if you happen to have the syntax for that I'd be appreciative
Thanks again.
Mark
-
Thank you Leslie. Yes, I can browse to the blog... pages and they remain that way in the browsers URL field. So, the thinking is that this has been around all along and Moz/Google just found it? Interesting.
So, any idea on how I would fix this? I do use the Redirection plugin (and have been entering quite a few redirects recently) but as far as I can tell that plugin allows me to redirect between pages, rather than redirect subdomains i.e. I can redirect http://www.<domain>.com/page1</domain> to http://www.<domain>.com/page2</domain> but not www -> something else.
Thank you again, Leslie.
-
I'm going to guess that you have something that looks like this in your .htaccess file:
RewriteRule ^blog/$ http://blog.website.com [L,NC,R=301]WARNING
You can knock your site down with the slightest syntax error when you mess with the htaccess file. Proceed with caution.
Let us know what you find.
-
Can you access the pages at blog.yoursite.com? Do they show up in the browser? It could be an issue that has always been there that Google just found.
-
I should add that I do have a DNS record for the blog subdomain. However, that has been in place all along, including the last few weeks where these duplicate content errors didn't exist. Given the settings in Settings \ General I would expect these to be redirected to http://www.<domain>.com</domain>, which seems to be what was happening up until this weeks report.
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
-
Selectively 301 redirects
Hi there: We are developing a pretty typical 301 redirection strategy. We basically are moving blog posts from a former sub-domain to the top level of our new designed site. We've pulled a site crawl of the old sub-domain and want to make sure we redirect any posts with a significant backlink profile to their current counterparts. Most other posts are just going to be redirected to the main 'front door' of our new blog. Is there a way to selectively redirect a certain number of posts and then 'globally' redirect everything else to a single URL? I would assume this would be a pretty common task, but can't find an easy way to do what we want to do.
Intermediate & Advanced SEO | | Daaveey0 -
Shopify Redirects
I work for a company who has a few url issues. One url is www.randomwords.com/random/type:random The other is www.randomwords.com/random/type-random What is the best way to go about this issue?
Intermediate & Advanced SEO | | MasonInteractive0 -
How many redirects are too many?
Hello Everyone, I currently have a dynamic site and it is my understanding that switching to a static site would be beneficial. I already have some 301's in place from when my site had a .php extension to the new extension now with ./?... etc. Is it okay to re redirect them? How many redirects are too many? Thank you in advance for suggestions. Have a Fabulous Friday! Sandra
Intermediate & Advanced SEO | | rankmenow0 -
Changing URL structure of date-structured blog with 301 redirects
Howdy Moz, We've recently bought a new domain and we're looking to change over to it. We're also wanting to change our permalink structure. Right now, it's a WordPress site that uses the post date in the URL. As an example: http://blog.mydomain.com/2015/01/09/my-blog-post/ We'd like to use mod_rewrite to change this using regular expressions, to: http://newdomain.com/blog/my-blog-post/ Would this be an appropriate solution? RedirectMatch 301 /./././(.) /blog/$1
Intermediate & Advanced SEO | | IanOBrien0 -
SEO: Subdomain vs folders
Hello, here's our situation:We have an ecommerce website, say www.example.com. For support, we use zendesk which offers a great platform that makes publishing FAQ and various resource articles very easy. We're torn between publishing these articles on our actual website, or publishing them via Zendesk. If we publish them on our website, the url would be something like:
Intermediate & Advanced SEO | | yacpro13
www.example.com/articles/title_article.html On the other hand, if we publish them via zendesk, the url would look like:
support.example.com/articles/title_of_article We would like to publish them via Zendesk, however, we do no want to miss out on any SEO benefit, however marginal it may be. Doing it this way, the domain would have all of the ecommerce pages (product and category pages), and the subdomain would have ALL other types of pages (help articles and also policies, such as return policies, shipping info, etc etc). I know a long time ago, folders were preferred over subdomains for SEO, but things change all the time.Do you think setting up all the ecommerce pages on the domain, and all content pages on the subdomain, would be a lesser solution? Thanks.0 -
Should you cache redirects?
I would like to know what fellow SEO people think, should you cache a redirect? Problems I see with caching redirects are meta refreshes and there might be a slow down in page load, but is it a big issue? Should we cache redirects? Do pages get indexed more if you cache redirects? Our ecommerce product pages are all dynamic, and currently we cache redirects but i'm seeing a lot of meta refresh issues. Another area that cropped up is that, the redirect doesn't pass on query parameters. Our system dumps URLs and they are redirected to SEO ones, but the redirect doesn't pass on parameters like Google Analytic tracking tags. What are your thoughts? Thanks
Intermediate & Advanced SEO | | Bio-RadAbs0 -
Should I redirect all my subdomains to a single unique subdomain to eliminate duplicate content?
Hi there! I've been working on http://duproprio.com for a couple of years now. In the early stages of the website, we've put into place a subdomain wildcard, that allowed us to create urls like this on the fly : http://{some-city}.duproprio.com This brought us instantly a lot of success in terms of traffic due to the cities being great search keywords. But now, business has grown, and as we all know, duplicate content is the devil so I've been playing with the idea of killing (redirecting) all those urls to their equivalent on the root domain. http://some-city.duproprio.com/some-listing-1234 would redirect to equivalent page at : http://duproprio.com/some-listing-1234 Even if my redirections are 301 permanent, there will be some juice lost for each link redirected that are actually pointing to my old subdomains This would also imply to redirect http://www.duproprio.com to http://duproprio.com. Which is probably the part I'm most anxious about since the incoming links are almost 50/50 between those 2 subdomains... Bringing everything back into a single subdomain is the thing to do in order to get all my seo juice together, this part is obvious... But what can I do to make sure that I don't end up actually losing traffic instead of gaining authority? Can you help me get the confidence I need to make this "move" without risking to lose tons of traffic? Thanks a big lot!
Intermediate & Advanced SEO | | DuProprio.com0 -
How to get subdomains to rank well?
Hi All, I am setting up a new site and I want to make use of subdomains to target multiple countries as follows: uk.mydomain.com us.mydomain.com australia.mydomain.com etc. Now i know what you're all going to say, why not use folders as they are more effective. Well I did think of this but decided against it because I would like to make the best of a low competition industry. I want to push my competitors as far down in the SE's as possible and i plan to do this by targeting generic non locational search terms with both sites so I can hog the top 4 spots.as follows: www.mydomain.com www.mydomain.com/keyterm uk.mydomain.com uk.mydomain.com/keyterm-in-the-UK Whats steps can I take to ensure rank passes to my subdomains? Is it better to start the site with folders like www.mydomain.com/us/keyterm and then 301 them to subdomains at a later stage or should i start with the subdomains?
Intermediate & Advanced SEO | | Mulith1