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
-
Redirecting an Entire Website?
Is it best to redirect an old website to a new website page by page to like pages or just the entire site all at once to the home page of the new site? I do have about 10 good pages on the site that are worth directing to corresponding pages on the new site. Just trying to figure out what is going to preserve the most link juice. Thanks for the help!
Technical SEO | | photoseo10 -
How do I optimize a website for SEO for a client that is using a subdirectory as a seperate website?
We launched a subdirectory site about two months ago for our client. What's happening is searches for the topic covered by the subdirectory are yielding search results for the old site and not the new site. We'd like to change this. Are there best practices for the subdirectory site Specifically we're looking for things we can do using sitemapping and Webmaster tools. Are there other technical things we can do? Thanks you.
Technical SEO | | IVSeoTeam120 -
Canonical & rel=prev / next changes to website a good idea or not?
Hi all, I decided yesterday to make a load of changes to my website, and today i woke thinking, should i have done that! So below is an example of what i have done (i will try to explain clearly anyway), can you let me know if you think what i have done would harm or help my website in search results etc... ok, so lets take just one category - Cameras And it has the sub categories - box dome bullet it also has other sub categories (which are actually features, but the only way i can show them on my site is by having them as a sub-category with its own static page, and adding the products to these as secondary categories) vandal proof high resolution night vision previously i have it set up so that every single category / sub category / feature had its own static page, with a canonical tag to itself (i.e cameras.html canonical was to cameras.html, vandalproof.html canonical was to vandalproof.html). Any of the categories / sub cats / features that had more than one page were simply not in search results due to the canonical pointing to "Page 1"... What i have now done: Last night i decided to change all this, now for all categories / sub cats / features i have add rel=prev / next where applicable, and removed the canonical from second / third / fourth pages etc, but left the canonical on "page 1". I also removed any keywords from page 2,3,4 etc and changed descriptions to just page "X" + category name. So for example, page one looks like: and page two looks like: I also went a little further (maybe too far) and decided that the features pages would canonicalize back to cameras so for those i now have: Page 1: Page 2: Any advice is welcome on the above, in regards to which way may be better and why, and obviously if anything jumps out as a mistake... Please advise James
Technical SEO | | isntworkdull0 -
Using a non-visible H1
I have a developer that wants to use style="text-indent:-9999px" to make the H1 non-visible to the user. Being the conservative person I am, I've never tried this before and worry that Search Engines may think this is a form of cloaking. Am I worrying about nothing? And apologies if it's already been covered here. I couldn't find it. Thanks in advance!!!!
Technical SEO | | elytical0 -
Should I promote each section of my website
Hi, i have a magazine website and i have been heavily promoting the main page of the site thinking that all the work i am doing for the main page which includes links and so on would then pass onto the rest of my site but i have a feeling this is not correct. Can anyone let me know if i should be concentrating on each section of the site and also on my articles should i be promoting these articles or let the search engines pick them up. I already use facebook and twitter to promote new articles but i would like to know if i should be doing more than this
Technical SEO | | ClaireH-1848860 -
Should I change my host
Have a feeling that the answer will be obvious here but more opinions are always good... I own a number of domains, mainly com, which are targeted at the UK but hosted in the netherlands. I have noticed a very high number of dutch hits to my sites. Lower than UK but takings population into account it works out to be higher. I fear my decision to renew my dutch server instead of going for a UK one is helping me rank in the wrong part of the world. I have paid a couple of months ahead for the dutch server but am wondering if the cost of writing off a couple of hundred pounds will be less than I'm losing due to my location. Should I take the financial hit on the server in the hope that buying a UK one will increase my relevant traffic?
Technical SEO | | Grumpy_Carl0 -
Should i Change On Page Optimization ?
Hi, PC monitoring and computer monitoring software are our targeted keywords. Around 5 weeks ago, We created a page for pc monitoring software (home/pc-monitoring-software) and did some bookmarking and guest posts targeting PC monitoring software keyword. Now we are in Top 15 on Google for PC monitoring software keyword . Initially we were thinking to change content of around 2 year old home page to adjust computer monitoring software keyword and do SEO for this keyword. But few days ago, we noticed that our pc-monitoring-software page is already ranking in early fourties for computer monitoring software keyword as well. May be Google is giving advatage of being synonym of PC . Now we are thinking that we should optimize the PC monitoring software page for both computer and PC software keywords like adding "computer monitoring software" in addition to existing "pc monitoring software" in title and similalrly do other on page related work for Computer Mnitoring Software. We are also thinking of doing 301 redirect of existing pc-monitoring-software page to new computer-monitoring-software page which will be optimized both for PC and Computer. Please suggest me if it will help to get good ranking for both PC and Computer Monitoring software if we make above mentioned changes or we should not change the existing pc-monitoring-software page and shall stick to earlier plan of changing the home page to adjust for computer monitoring software.? I'm new to SEO, so want to make wise decision with your help instead of learning with failures. Thanks, shahzad
Technical SEO | | shaz_lhr0 -
Internal website search
Hi, I'd like to index dynamically generated - internal website search pages - to Google. A mod rewrite to make the URL strings friendlier might be one way, but as these pages are created on the fly and effectively don't exist till the search keywords are inputted, is it even possible to index them? thanks
Technical SEO | | richcowley0