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
-
How to change the woocommerce product page permalink
Sorry Posting it again. 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 -
Website Redesign - Blogger To WordPress Platform URL Structure
I am transferring a website (www.EXAMPLE.com) From Blogger To Wordpress. Currently, the website content is specific to cover the Colorado Market. In the near future, I plan on covering the same market in other state. I have seen regional websites like this that have the URL structure - (STATE.EXAMPLE.com) I have also seen websites with URL Structure - (EXAMPLE.COM/STATE) Is there any advantage using one URL structure over the other in term of SEO & otherwise? In the process of transferring the website, I would like to clean-up the URL structure but I don't want to lose a significant amount of link juice/organic traffic. Do you recommend I restructure the URLs at this time?
Technical SEO | | InternetRep0 -
XCart Directory 301s Not Working
I'm working with someone to make fixes to an xcart site but I'm at a loss for some fixes. Some directory URLs had been changed around on their ecommerce site to make them more descriptive & more human friendly. The problem is that according to the team's coder, simple redirects won't work for the directories and mod rewrite and redirectmatch didn't work for some unknown reason. I don't really know anything about xcart. I've made some basic changes and redirects before though their admin panel but I don't have any clue as to how to make directories 301 properly. Any insights? Thanks!
Technical SEO | | MikeRoberts0 -
Website is not indexed in Google
Hi Guys, I have a problem with a website from a customer. His website is not indexed in Google (except for the homepage). I could not find anything that can possibly be the cause. I already checked the robots.txt, sitemap, and plugins on the website. In the HTML code i also couldn't find anything which makes indexing harder than usual. This is the website i am talking about: http://www.xxxx.nl/ (Dutch) The only thing that i am guessing now is the Google sandbox, but even that is quite unlikely. I hope you guys discover something i could not find! Thanks in advance 🙂
Technical SEO | | B.Great0 -
Do You Have To Have Access to Website Code to Use Open Graph
I am not a website programmer and all of our websites are in Wordpress. I never change the coding on the backend. Is this a necessity if one wants to use Open Graph?
Technical SEO | | dahnyogaworks0 -
301 redirect to new website
We are migrating to a new website that will be using entirely new URLs under the same domain as the old website. The old website is a custom PHP script and the new website uses Drupal. I know that I should use individual 301 redirects to the corresponding new pages. My question is just how to set up the hundreds of 301 redirects from the old website to the new one? Here is the process I've come up with. Please let me know if there is an easier and better way for this. Before actually changing to the new website: download an advanced report with all pages on this domain from OSE. Find corresponding pages on the new website Make the hundreds of 301 redirect lines in an .htaccess file with the following code: redirect 301 /oldurl.html http://domain.com/the-full-url Thanks in advance for your help!
Technical SEO | | qbeeker0 -
I have 2 websites with the same content
Hello everyone, this is my first post here on SEOmoz and I have a questions that I cannot seem to figure out. So here is my scenario: I have 2 websites that are identical. The only difference between the 2 websites is the domain name. This was done a while back for marketing purposes, however, I am no longer needing my 2nd website. What is the best way to get rid of this second website? I still have about 1 paying customer a day convert on this 2nd website and I do not want to loose them, however, I know that I am getting penalized by the search engines because of this duplicate content. Please let me know the best way of going about this. PS: I have read about 301 redirects, canonicalizing URLs, and other methods but do not know which one to choose. Any help is greatly appreciated!
Technical SEO | | threebiz0 -
How to tell google about the changes
Hello All this is my first question here. we have recently changed our website design and backend. so the problem now is in google it is showing the old url's and when ever a client come from google he is prasented with a 404 error page if this happenes many times. will google penalise our site ? if yes. how to prevent this from happen. waiting for some replies.. thanks
Technical SEO | | idreams1