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
-
New website - not showing in Google?
This site was launched 3 days ago, bimcosupply.com and I'm trying to get it to show in Google just for a branded search for the moment (Bimco, Bimco Corporation, etc). The old site is still showing in search, bimcoplumbingsupplies.com instead. This site was taken down a while back. I set up a redirect for the domain in cPanel, and also set individual pages to redirect in WordPress on the bimcosupply.com site. I've verified the site in Google Search Console, submitted a sitemap and did URL inspection on each page. Each page is showing as indexed, though now when I search site:bimcosupply.com not all pages are there, and there are two results for the home page, one "https" and one "http." (Before today, all of the pages were showing so not sure what changed). I know this new domain does not have any (or very little) domain authority yet, but I would have thought that the site should display for branded search by now. So I'm concerned that something is wrong with the site, how the redirects are set up, etc. that is preventing it from displaying. Could anyone take a look and help me figure this out please?
Technical SEO | | browncreative0 -
Wordpress Pods and Wordpress SEO by Yoast
Hi I am optimising a new site that has been built in Wordpress using Pods. The Yoast Wordpress SEO plugin is not recognising any content on the site - has anyone any ideas on how to get around this - does it matter - is it the plugin that is at fault rahter than the set up of the site?
Technical SEO | | Highlandgael1 -
The use of robots.txt
Could someone please confirm that if I do not want to block any pages from my URL, then I do not need a robots.txt file on my site? Thanks
Technical SEO | | ICON_Malta0 -
How to change noindex to index?
Hey, I've recently upgraded to a pro SEOmoz account and have realised i have 14574 issues to do with 'blocked by meta-robot' and that 'This page is being kept out of the search engine indexes by the meta tag , which may have a value of "noindex", keeping this page out of the index.' How can i change this so my pages get indexed? I read somewhere that i need to change my privacy settings but that thread was 3 years old and now the WP Dashboard has updated.. Please let me know Many thanks, Jamie P.s Im using WordPress 3.5 And i have the XML sitemap plugin And i have no idea where to look for this robots.txt file..
Technical SEO | | markgreggs0 -
Does anyone know a sitemap generation tool that updates your sitemap based on changes on your website?
We have a massive site with thousands of pages which we update everyday. Is there a sitemap generator that can create google sitemaps on the fly and change only based on changes in the site? Our site is much too large to create new sitemaps on regular basis. Is there a tool that will run on server that does this automatically?
Technical SEO | | gwynethmarta0 -
Would moving a large part of our website onto a separate website be SEO suicide?
Hello, Our website currently has what I would call educational and sales pages - which sells our services and also a techy section for the developer community. The developer pages on the website have some of the highest authority pages that we have and equates for about 50% of the content. It has been proposed to move the developer pages onto their own domain - away from the main website. Now, would this crush a lot of the SEO benefit that we have on our main site? Does anyone know of a workable solution that would help retain the SEO. Would linking to our main site from the developer site help? It would be great to hear what people think, Thanks,
Technical SEO | | esendex0 -
Permalink structure for Wordpress Getshopped Plugin
Hi everyone, has anyone had any experience with Getshopped eCommerce plugin for Wordpress and it's permalink structure? Currently the permalink reads something like http://www.sitename.com/products-page/product-category/product-description/ I would like to modify it to be http://www.sitename.com/product-description/ but the SEO Plugin I am using All-in-One SEO only allows me to edit the "product-description" part of the permalink and not the "products-page/product-category/" part of it The permalink structure is set to /%postname%/ under Settings in Wordpress. Any help/comments will be greatly appreciated Thanks
Technical SEO | | webseoservices0 -
Recommended Wordpress Plugins
Hey Seomoz'ers, What would you recommend to use as plugins for wordpress when starting a new blog?
Technical SEO | | asimahme0