Home › Forums › BulletProof Security Free › 301 redirects not working
- This topic has 4 replies, 2 voices, and was last updated 2 weeks, 2 days ago by AITpro Admin.
-
AuthorPosts
-
HannahParticipant
Hi, I’m redesigning a client’s site. We had to replace a sunsetting cart with WooCommerce. She wanted custom pages for many if not all of her shop pages, so I need to redirect the default WooComerce pages to the custom pages. I’ve created the redirects and added them to the bottom field, but they don’t seem to be working (tried the top field too but that also didn’t result in working redirects). What I’m trying to accomplish in addition to bypassing all the default pages is to make the breadcrumbs on the product listing pages work. What am I missing here?
HannahParticipantSorry, forgot to tell you that the website is https://carpediempapers.com/staging/
AITpro AdminKeymasterIt looks like you have installed a subdirectory WordPress installation in this folder > /staging
The main Store page is here > /staging/carpe-diem-papers-shop/
The Cart/Checkout page is here > /staging/cart/
The Account page is here > /staging/my-account/
The site is using this Category in WP Permalinks > product-category > /staging/product-category/greeting-cards/
Is the Category what you are referring to as bread crumbs?
I would need the destination URL for the redirects to be able to provide you with htaccess redirect code.
HannahParticipantThe “breadcrumbs” are the links at the top of default category pages and product listing pages that let one easily jump back to the parent category(ies). We’re using WooCommerce and that’s a default feature of their shop pages. However, they don’t seem to be respecting the redirects and still lead to default pages, which I have redirected to custom pages in .htaccess. An example is:
Redirect 301 /product-category/original-paintings/ https://carpediempapers.com/staging/carpe-diem-papers-shop/original-paintings/
So, if you go to https://carpediempapers.com/staging/carpe-diem-papers-shop/original-paintings/ you see a custom page (in progress). You click the first product link and go here: https://carpediempapers.com/staging/product/hydrangeas-in-delft-original-painting/. This is a default product page and the breadcrumbs are above the product image. If you want to go back to the Original Paintings category page by clicking the breadcrumb link, you wind up here: https://carpediempapers.com/staging/product-category/original-paintings/. A default category page, not the custom one. This is what I’d like to avoid, but the 301 redirects aren’t working.
I hope this describes the situation better. And that you can help me figure out why the redirects in .htaccess aren’t working.
Thank you.
AITpro AdminKeymasterRedirectMatch is much better than Redirect. It gives you much more control if you use RegEx. You must start from /staging because that is the root folder and URL. ^ means start and $ means end in this code. so redirect everything with this root url > /staging/product-category/original-paintings/ to this destination url > https://carpediempapers.com/staging/carpe-diem-papers-shop/original-paintings/. You are basically rewriting the product-category portion of the url, but if that is hard coded into WooCommerce or set in WP Permalinks then the WP DB is going to try to rewrite that at the DB level. give this code a whirl.
RedirectMatch 301 ^/staging/product-category/original-paintings/$ https://carpediempapers.com/staging/carpe-diem-papers-shop/original-paintings/
-
AuthorPosts
- You must be logged in to reply to this topic.