0

I've got a problem. My client has taken ads with ex.com/helloworld as the short URL to their new page.

No problem, I'll do a htaccess redirect on it, redirect the shorturl to the right page (which is ex.com/careers/helloworld-recruiting)

But theres a page on my site which is ex.com/services/helloworld, and for some reason, the htaccess redirect is bypassed in favor of the automatic wordpress URL recognition redirect.

So how can I ask Wordpress to kindly fuck off so I can use my own redirect instead of his?

Here's the line in my htaccess, tested with https://htaccess.madewithlove.be/ it should go through as expected.

RewriteRule ^helloworld/$ //careers/helloworld-recruiting/ [L,R=301]

2

Not really a WP-specific question, but I'll help you out. That regex will match ex.com/helloworld/ but not ex.com/helloworld.

To handle both you'd want RewriteRule ^helloworld/?$ /careers/helloworld-recruiting/ [L,R=301]

The question mark makes the preceding token optional and the single slash rather than double in the rewritten URL makes it relative to the root.

  • Yeah, just figured out that was my bug. The good old one character away from working, but you have no idea why it doesn't work – Fredy31 Jun 28 '18 at 20:45

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.