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
-
Using one domain for email and another domain for your website, but redirects...
Hello - We are rebranding and our new name is fairly lengthy. We own all main domain versions of our brand name - .com, .new and .org - There is a very high search volume for the new brand name as it is a merger of 2 popular existing brands so want to take advantage of that and use our full name within our website domain name. However, since the name is a little long as mentioned - 25 characters - we also own the 3 character acronym of the new brand so we are debating on using the acronym for our new email addresses. ie name@abc.com so it is user friendly. We would obviously redirect the acronym email domain to point to the longer website domain. Are there any negative SEO effects if we do that? Use the longer domain for the website and shorter acronym for our email? Thank you
Technical SEO | | KRBishopBh1 -
Website crawl error
Hi all, When I try to crawl a website, I got next error message: "java.lang.IllegalArgumentException: Illegal cookie name" For the moment, I found next explanation: The errors indicate that one of the web servers within the same cookie domain as the server is setting a cookie for your domain with the name "path", as well as another cookie with the name "domain" Does anyone has experience with this problem, knows what it means and knows how to solve it? Thanks in advance! Jens
Technical SEO | | WeAreDigital_BE0 -
Keyword rankings for new website good in Yahoo and Bing but no movement in Google?
Hello, This past September I launched a new redesigned website for a client. His old website was a static html site that was many years old and the new website was created using WordPress. With the new design we made sure to use all the proper techniques for SEO. (h1 tages, image names, quality links, page titles, etc.) Plus, all the content is new content written for this site. I've actually launched new sites many times and after a few months usually start seeing keyword ranking improvements from the major search engines. With this particular website I'm seeing improvements in Yahoo and Bing but no movement in Google. I've used Google Webmaster Tools and made sure my sitemap is being submitted, etc. It all seems good, but I can't understand why Yahoo and Bing are working but nothing from Google. My page grades are all A's and B's and Moz isn't showing any big issues. Maybe I need to give it more time? This client is a lawyer and has many websites out there so maybe he's being penalized somewhere I don't know? As I mentioned, I've been doing SEO for about 8 years and have never had this much trouble with Google. I was wondering if you can look at the site and see if there are any glaring issues I'm missing. Website: http://www.arizonamedicalmalpractice.info/ The keyword phrases were are looking at are "Phoenix Medical Malpractice Lawyer", "Phoenix Medical Malpractice Attorney:, "Arizona Medical Malpractice Lawyer & Attorney", etc. I appreciate anyone who takes the time and does a quick look over. Thanks very much, Bill
Technical SEO | | Bill_K0 -
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 -
Using the same domain for two websites (for different geographical locations)
Hi all, My client has a new E-commerce site coming out in few months.
Technical SEO | | skifr
His requirement is to use the same domain (lets call it www.domain.com for now) for two seperate websites:
The first site, for users with ip addresses from USA - which will include prices in US dollars.
The second site - for users outside of the US - will not include any prices, and will have different pages and design. Now, lets say that googlebot crawls the websites from different ip ranges. How can i make sure a user from France, for example, won't see crawled pages from the US? Sure, once he will click the result, I can redirect him to a "Sorry, but this content is unavailable in your country" page. The problem is, I don't want a user from France to see the in the search results the meta description snippets of pages related only to users in the US (in some cases, the snippets may include the prices in $).
Is Geotargeting through Webmaster Tools can help in this case? I know I can target a part of the website for a specific country (e.g. - www.domain.com/us/), but how can I make sure global users won't see the pages targeted only to the US in the search results? Thanks in Advance0 -
New website, to www or not
I was just wondering if there are any advantages to using the www instead of just the domain name for seo. Can these be elaborated on?
Technical SEO | | simvegas1 -
Ping Services for Wordpress
I have been trying to research adding ping services to the default list in wordpress, which only includes http://rpc.pingomatic.com/ A lot of the articles that I have come across seem to be quite old, can anyone tell me if this is still relevant and if so, which services do you find to be worthwhile using? Thanks
Technical SEO | | pugh0 -
Do you validate you websites?
Do you consider the guidelines from http://validator.w3.org/ when setting up a new website? As far as I know they don't influence rankings ... What is your opinion about that topix?
Technical SEO | | petrakraft0