Changing permalinks in new wordpress website using regex in 301s?
-
Hi there
I am working on a website and we would like to change the permalinks from product-category (replacing with Shop) and product to buy. Currently there are nearly 400 products and multiple categories.
Although the website has just been indexed wondering if we need to do 301's? if we did would like to use regex to manage
so redirect would be as example: mydomain.com/sub-domain/product-category/ redirecting to to mydomain.com/sub-domain/shop/ (I know you do not need to put in the domain but as an example) - could anyone give me the regex for this?
Same for products: mydomain.com/sub-domain/product/sample-product redirect to mydomain.com/sub-domain/buy/sample-product
thanks in anticipation
-
You're welcome. Hope it worked out for you. You can mark this as answered if the problem is solved.
-
Thanks so much for your responses. Will try that now
-
Hello Allie,
Here is the basic regex redirect code to place in your htaccess file.
RedirectMatch 301 /sub-folder/product-category/(.) /sub-folder/shop/$1
RedirectMatch 301 /sub-folder/product/(.) /sub-folder/buy/$1Hope this helps. You can also find more information on redirecting old pages using regex from WPEngine here.
-
Hi Allie,
Sounds like you've got two questions:
First, you'll need to use 301s if you have any inbound links to the pages that you're replacing.
Second, you can't use Regex in HTML. Do you have a CMS that can help you build the 301s?
Best,
Kristina
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
-
Migrating website to new CMS and to https://
Hi, We are migrating an old website to a new one built in Wordpress soon. We also added an SSL to change to https:// Most of the url's stay the same. Can we just migrate from http to https on server level, and for the url's that do change just set a 301 redirect? Or are there other things we should take into account?
Technical SEO | | Mat_C0 -
How to change the woocommerce product page permalink
How I can change the product URL structure. Please let me know how to fix woocommerce permalink in wordpress. My current URL is http://www.ayurjeewan.com/product/divya-ashmarihar-kwath and I want to like (only post name) http://www.ayurjeewan.com/divya-ashmarihar-kwath Attached is the screenshot of option available. qa2hZMP.jpg
Technical SEO | | JordanBrown0 -
Want to move site to wordpress and keep links without using redicrects
I have an old cluny site that has been around for about 56 years. It is on the homestead platform. I want to move the site to a thesis theme 2.1 wordpress platform without losing my links. I would prefer not to do 301 redicrects. With thesis I can specify the URL for each page of the wordpress site, however the wordpress site is hosted on hostgator as a subdomain of another site and the other problem is that wordpress adds a back slash that is not present on the old site. I can, however add .html to the URL's for pages on the wordpress site to conform to the URL's on the old html site. Will this work? thx Paul p.s. the URL for my old site is www.affordable-uncontested-divorce.com
Technical SEO | | diogenes0 -
Slow website
Hi I have just migrated from a custom written php/mysql site to a site using wordpress and woocommerce. I couldnt believe the drop in speed . I am using a few plugins for wordpress - contact forms / social sharing. and I have a few woocommerce plugins for taking payment etc. I am hosting images css's and js's on W3 Total Cache and MAXCDN hoping to speed the site up but tools at http://tools.pingdom.com/fpt sometimes show that the time between browser request and reply can be between 1 and 15 secs. I have searched all day looking for a post I read about two months ago with a tool that seems to look at server responce and redirect processing etc hoping it would help but cant find it. If anyone knows what I am talking about I would appreciate them posting a link The site is http://www.synergy-health.co.uk and an example of an inner page is http://www.synergy-health.co.uk/home/shop/alacer-emergen-c-1000-mg-vitamin-c-acai-berry-30-packets-8-4-g-each/ Any suggestions please? Perhaps I have w3total cache set wrong? Also, as the has been tanked and is in freefal iin google ranking since January would this be a good time to change the structure of Url from home/shop/product to domain.name/brand/product? Thanks in advance !
Technical SEO | | StephenCallaghan0 -
Guidance for setting up new 301s after having just done so (
Hi I've recently set up a load of 301 redirects for a clients new site design/structure relaunch One of the things we have done is take the kw out of the sub-category landing page url's since they now feature in the top level category page urls and don't want to risk over-optimisation by having kw repeats across the full urls. So the urls have changed and the original pages 301'd to the new current pages. However If rankings start to drop & i decide to change urls again to include kw in final part of url too for the sub category landing pages, whats best way to manage the new redirects ? Do i redirect the current urls (which have only been live for a week and have the original/old urls 301'd to them) to the new url's ? (worried this would create a chain of 301's which ive heard is not ideal) Or just redirect the original urls to the new ones, and can forget about the current pages/url's since only been live for a week ?
Technical SEO | | Dan-Lawrence
(I presume best not since GWT sitemaps area says most new urls indexed now so I presume sees those as the original pages replacement now) Or should they all be 301'd (original urls and current urls to the new) ? Or best to just run with current set up and avoid making too many changes again, and setting up even more 301's after having just done so ? Many Thanks 🙂 Dan0 -
Optimizing Flash websites
Does anyone know the latest on how well Google is indexing flash sites? I'm talking to a prospect now whose site is 100% flash, but looking at it all the content within the site is indexed and returning in the results. This is promising enough, but does anyone know exactly how well Google is indexing flash content these days and are there still any problems with that? Thanks!
Technical SEO | | MattBarker0 -
Is it ok to just use the end of the url when using a Rel Cononical Link?
Hi, I am working with an account and the previous SEO used a Rel Canonical link that just uses the end of the url. Instead of the full url When I look it up on the web I see most people are using the full url. Is that the proper way to do it or does is suffice to just use the end of the url? Wanted to check before I take the time to change them all. -Kent
Technical SEO | | KentH0