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
-
Yes, sorry, I missed that part! That looks great.
-
Thanks! Yes, in my original post, I ask if the format of the mod_rewrite is correct for a 301 redirect. I realize we need 301 redirects. I am wanting to do it so I don't have to do a direct 1 to 1 for every page:
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
-
Whether you use a mod_rewrite or a 1 - 1 301, the end result is a 301 redirect. If you are changing the URL at all, even from http to https, you will need to tell Google that the URL has moved, hence, the 301 redirect. If you do not 301 redirect your old URLs you will lose all SEO value, traffic and link juice for the old URLs.
Does that make sense? Setting the redirects in Apache is simply a shortcut to the 301 step. Whichever path you take, you are ending at a 301.
And the syntax you wrote above looks correct for the rewrite script.
-
Hey Monica! Thanks for your response.
On Apache, you can set redirects before the server sends you to the domain. This is a preferred method for us. Erica was kind enough to suggest using WP to do so, but with thousands of blog posts, this really isn't an option to do a 1 to 1 301 redirect for every post.
Because of that, we're looking at **mod_rewrite **instead of a 301 plugin or using .htaccess, but I'm a little fuzzy on the appropriate syntax for it to work correctly.
-
Even if you are moving away from WP, you will set up your redirects the same way. You can do that through the HTAccess file to make sure that they are pointing to the correct pages on your new site.
-
Thanks for the response!
I should have mentioned that we are moving away from WP on the new domain.
-
I'd go in and change the structure in WP and then 301 the old URLs with the redirect. Then your new posts going forward will only have the cleaned up URL structure and the old ones will be properly 301'd for all the SEO goodness.
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
-
Redirect Issue - Drop in ranking after CMS change
Hi Website - https://www.aasprint.com.au/ After we moved the site from wordpress to codeIgniter + angular there has been a huge drop in traffic and ranking. One of the thing we recently realized is the redirection - COULD THAT BE THE ISSUE? On the browser and sitemap the URL doesn't have "/" at the end When checked on redirection tool the URL seems to be redirecting to one with "/" at the end Attached are the screenshots. Also moz bar shows no redirection. However, the issue seems to be flagged by the site audit tool as 301 redirection. Not sure if it's the cause for the drop. What action to take? Any advice would be much appreciated. V7CNtqt j3dJ4TW
Intermediate & Advanced SEO | | Bhisshaun0 -
Looking to remove dates from URL permalink structure. What do you think of this idea?
I know most people who remove dates from their URL structure usually do so and then setup a 301 redirect. I believe that's the right way to go about this typically. My biggest fear with doing a global 301 redirect implementation like that across an entire site is that I've seen cases where this has sort of shocked Google and the site took a hit in organic traffic pretty bad. Heres what I'm thinking a safer approach would be and I'd like to hear others thoughts. What if... Changed permalink structure moving forward to remove the date in future posts. All current URLs stay as is with their dates Moving forward we would go back and optimize past posts in waves (including proper 301 redirects and better URL structure). This way we avoid potentially shocking Google with a global change across all URLs. Do you know of a way this is possible with a large Wordpress website? Do you see any conplications that could come about in this process? I'd like to hear any other thoughts about this please. Thanks!
Intermediate & Advanced SEO | | HashtagJeff0 -
URL structure change and xml sitemap
At the end of April we changed the url structure of most of our pages and 301 redirected the old pages to the new ones. The xml sitemaps were also updated at that point to reflect the new url structure. Since then Google has not indexed the new urls from our xml sitemaps and I am unsure of why. We are at 4 weeks since the change, so I would have thought they would have indexed the pages by now. Any ideas on what I should check to make sure pages are indexed?
Intermediate & Advanced SEO | | ang0 -
Can I undo a 301 redirect? Will it penalize my ranking?
I'm in charge of building a website for a company that made a mess. They own domain xxx.it (xxx is not the real domain, just a placeholder). Some years ago they 301 redirected xxx.it to xxx.com (they just changed TLDs). Last year they 301 redirected xxx.com to yyy.com (so, they actually changed domains). Now, after 13 months, the company failed and the new leadership wants me to undo everything and 301 redirect from yyy.com to xxx.it. So: 301 redirect is permanent. So, conceptually it's wrong to undo it. What happens if I undo it? Will my ranking be penalized, even if a significant amount of time has passed (13 months)? Will crawlers detect a loop (even if i remove any 301 redirect from xxx.it and theorically break the loop)? Here is the potential loop: xxx.it -> xxx.com -> yyy.com -> xxx.it -> etc... All of the articles I found on the web are quite old and not clear about this topic, that's why I'm asking this question.
Intermediate & Advanced SEO | | naska19900 -
HTTPS Login on HTTP Site | 301 or 302 Redirect?
I've searched the forum on this and online and can't seem to find a definitive answer. Some e-commerce sites that are http use a 302 redirect to the https login while other sites use a 301 redirect. I know 302 is generally not recommended but in this case it may make sense. Can anyone advise on the correct practice?
Intermediate & Advanced SEO | | CallMeNicholi0 -
Recommended URL Structure
Hello, We are currently adding a new section of content on our site related to Marketing and more specifically 'Digital Marketing' (research reports, trend studies, etc). Over time (several months, or 1-3 years) we will add more 'general' marketing content. My question is which of the following URL structures makes more sense from an SEO perspective (and how best to quantify the benefit of one over another): www.mysite.com/marketing/digital/research/... www.mysite.com/digital-marketing/research/.. Thanks, Mike
Intermediate & Advanced SEO | | mike-gart0 -
Canonicalization interact with 301 redirects?
This is a interesting one I think. I have recently taken down some product list pages from our website www.towelsrus.co.uk. These have canonicalisation in place to deal with pages where a query string is generated depending on the search criteria. When I put a 301 redirect in place the target page redirects fine, however webmaster tools then errors with 404 on all canonicalised pages. Is this correct behaviour and how do we get over this?
Intermediate & Advanced SEO | | Towelsrus0 -
301 vs Changing Link href
We have changed our company and want to 301 old domain from new domain in order to transfer the benefits of backlinks (DA: 50, 115 Linking Root Domains). I have the ability to modify around 50% of the backlinks. So my question is: Instead of redirecting all the links, should I update the 50% to link to the new domain instead of relying on redirects? Would this possibly trip an algorithmic filter and devalue these links? Or should I just do a 301 and not worry about modifying the links?
Intermediate & Advanced SEO | | Choice0