0

I just migrated one of my old websites to wordpress but running into issues with the 301's of the old url's

old url /11/companyname

new url /office/companyname/

This is the code i came up with

RewriteEngine On
RewriteRule ^([a-zA-Z-]+)/(.*)?$ /office/$2/ [R=301,L]

It redirects fine when i add the trailing slash i.e. /11/companyname/ but not without.

0

Try below Rule,

RewriteRule ^([a-zA-Z-]+)/(.*)/?$ /office/$2/ [R=301,L]

It makes trailing slash optional.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.