Problems with htaccess redirects on a wordpress site
- or -
Post a project like this1821
£25(approx. $31)
- Posted:
- Proposals: 3
- Remote
- #2357765
- Awarded
Description
Experience Level: Entry
I am creating some htaccess rules as part of a wordpress site migration.
On the old website the URL was:
/product-category/spearfishing-fins/
On the new website, it is just /spearfishing-fins/
So I am just trying to remove 'product-category' which ought to be simple enough.
Here are some solutions I have tried:
RewriteEngine on
RewriteRule ^/product-category/(.*) /$1 [R=301,L]
RewriteRule ^product-category/(.*)$ /$1 [R=301,L]
RewriteRule ^product-category/(.*)$ http://example.com/$1 [R=301,L]
RewriteRule product-category/(.*)$ /$1 [R=301,L]
None of these work - you can still access both :
/product-category/spearfishing-fins/
and
/spearfishing-fins/
Can you see anything that I'm missing?
The site is using the Premmerce permalink manager to get the shop URls I want which is full category paths and full product paths
e.g.
http://spearo.angeldigital.marketing/parent-category/child-category
http://spearo.angeldigital.marketing/parent-category/child-category/sample-product
I don't *think* this should be interfering with what I'm doing here but I may be wrong.
On the old website the URL was:
/product-category/spearfishing-fins/
On the new website, it is just /spearfishing-fins/
So I am just trying to remove 'product-category' which ought to be simple enough.
Here are some solutions I have tried:
RewriteEngine on
RewriteRule ^/product-category/(.*) /$1 [R=301,L]
RewriteRule ^product-category/(.*)$ /$1 [R=301,L]
RewriteRule ^product-category/(.*)$ http://example.com/$1 [R=301,L]
RewriteRule product-category/(.*)$ /$1 [R=301,L]
None of these work - you can still access both :
/product-category/spearfishing-fins/
and
/spearfishing-fins/
Can you see anything that I'm missing?
The site is using the Premmerce permalink manager to get the shop URls I want which is full category paths and full product paths
e.g.
http://spearo.angeldigital.marketing/parent-category/child-category
http://spearo.angeldigital.marketing/parent-category/child-category/sample-product
I don't *think* this should be interfering with what I'm doing here but I may be wrong.
Jen W.
100% (41)Projects Completed
36
Freelancers worked with
28
Projects awarded
50%
Last project
12 Feb 2024
United Kingdom
New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-
There are no clarification messages.
We collect cookies to enable the proper functioning and security of our website, and to enhance your experience. By clicking on 'Accept All Cookies', you consent to the use of these cookies. You can change your 'Cookies Settings' at any time. For more information, please read ourCookie Policy
Cookie Settings
Accept All Cookies