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
-
International Country URL Structure
Hey Guys, We have a www.site.com (gTLD) site, the primary market in Australia. We want to expand to US and UK. For the homepage, we are looking to create 3 new subfolders which are: site.com/au/ site.com/uk/ site.com/us/ Then if someone visits the site.com redirect based on their ip address to to the correct location. We are also looking to setup hreflang tags between the 3 sub-folders and set geo-location targeting in google search console at sub-folder level. Just wondering if this setup sounds ok for international SEO? Cheers.
Intermediate & Advanced SEO | | pladcarl90 -
Best-practice URL structures with multiple filter combinations
Hello, We're putting together a large piece of content that will have some interactive filtering elements. There are two types of filters, topics and object types. The architecture under the hood constrains us so that everything needs to be in URL parameters. If someone selects a single filter, this can look pretty clean: www.domain.com/project?topic=firstTopic
Intermediate & Advanced SEO | | digitalcrc
or
www.domain.com/project?object=typeOne The problems arise when people select multiple topics, potentially across two different filter types: www.domain.com/project?topic=firstTopic-secondTopic-thirdTopic&object=typeOne-typeTwo I've raised concerns around the structure in general, but it seems to be too late at this point so now I'm scratching my head thinking of how best to get these indexed. I have two main concerns: A ton of near-duplicate content and hundreds of URLs being created and indexed with various filter combinations added Over-reacting to the first point above and over-canonicalizing/no-indexing combination pages to the detriment of the content as a whole Would the best approach be to index each single topic filter individually, and canonicalize any combinations to the 'view all' page? I don't have much experience with e-commerce SEO (which this problem seems to have the most in common with) so any advice is greatly appreciated. Thanks!0 -
301 redirect recommendations
One of our clients we are working on have two sites the main with a PR5 and a separate one with a PR4. We are planning on doing a 301 from the PR4 to a page on the PR5 Is it best to do: www.PR4.com ----> www.PR5.com/releveantPR4page or www.PR4.com/page ----> www.PR5.com/releveantPR4page Most pages on the PR4 site can fit into one PR5 page logically. However the PR4 has an about us, contact us, blog/with posts, FAQ, Applications, Legal Resources which are all pretty out dated.. The PR4 site is kinda messy and we are not sure if it will be easy to 301 each page individually with the user in mind. can we do a sitewide 301 redirect from the root PR4.com to a page PR/5.com/releveantPR4page and also do deeper 301's? PR4.com/PR4page ---> PR5.com/releveantPR4page
Intermediate & Advanced SEO | | Bryan_Loconto0 -
Changing the spellings of titles and URl changes
Hi, Changing the spellings of titles and URl changes We identifies 500+ titles with some issues like spellings and punctuations and short or too long. We want to change them, but the titles are connected with the URL's when we change the titles the URl's change as well. My questions are 1. Is it a good way to change them all in one shot or do few daily 2. As the URl's change will Google index drop the old pages as they would be 404 and index new ones? 3. Will we have chances to have drop in traffic due to this? 4. Any way to redirect? as we have a Drupal website Thanks
Intermediate & Advanced SEO | | mtthompsons0 -
Should I change wordpress urls?
Should I change my wordpress permalinks to include the keyword? For examples at the minute my url is http://www.musicliveuk.com/home/wedding-singer. Is it better to be http://www.musicliveuk.com/live-bands/wedding-singer. 'home' is not relevant so surely 'live-bands' would be better? If I change the urls won't I lose 'link juice' as external links will all point to a url that no longer exists? Or will wordpress automatically redirect the old url to the new one? Finally, if I should change the url as described how do I do it on wordpress? I can only see how to edit the last bit of the url and not the middle bit.
Intermediate & Advanced SEO | | SamCUK0 -
301 Redirect - What happens to backlinks
Hello... One of my sites is losing rankings in G. I received the webmaster notification of unnatural links... My question is, should i do a 301 redirect of every page on my site to a new domain? If so, do the backlinks (which i believe are causing my rankings to drop) carry over? How about the good backlinks? Also, what would happen to the rankings i currently have on page 1? Thanks
Intermediate & Advanced SEO | | Prime850 -
Changing my url name? Should I do it?
Hi, I am targeting a brand called Creative Recreation, who are a trainers brand. We currently rank ok-ish for certain terms for Creative Recreation Trainers, Footwear and Creative Recreation [INSERT STYLE NAME HERE]. Our main search term I think we would like to improve on is "creative recreation trainers" as we are 6th for this. Our domain name points to the brands page as designerboutique-online.com/all-clothing/creative-recreation/ Now what I want to know is, would it be worthwhile or would it affect my current rank/index if I changed the end of that url to read /creative-recreation-trainers/ thus getting the keyword phrase in the url? Creative-Recreation is a hard one to crack as you have a lot of competition from the brands site etc.. Any ideas on this? Cheers Will
Intermediate & Advanced SEO | | YNWA0 -
301 redirect help
Hey guys, I normally work in WordPress and just use a 301 redirect plugin. I bought a site and rather than maintain two similar ones have decided to redirect one to the other. I am having trouble with the .htaccess file. Here is an example. These are two redirects: redirect 301 /category/models/next/2
Intermediate & Advanced SEO | | DanDeceuster
redirect 301 /category/models I want both of these URLs to redirect to the same URL of the new site. However, the /category/models is the only one working. It redirects to the new page just fine. The /category/models/next/2 is redirecting to nearly the same URL on the new site, only it is adding /next/2 to the end and that is bringing up a 404. Why is it adding /next/2 to the new URL? How can I fix this? There are several doing this. Help appreciated!0