I currently have /a1234 (any number after letter "a") rewriting to page.php?var=1234,
I have 1 particular page with number 55 I need to redirect elswehere.
rewriterule ^a55 /home/public_html/otherpage.php
While this simple line works, it also redirects /a555, /a5555 etc… to otherpage.php
- How do I only have it redirect just 55 and not 555 etc. ?
2
Answers
With your shown samples, please try following htaccess rules file. Make sure to clear your browser cache before testing your URLs.
Make sure your new rule is places above old rule.
This matches any URL-path that simply starts
a55
. The^
is a start-of-string anchor. You also need an end-of-string anchor ($
) to match just that URL-path. For example:You should also include the
L
flag, to prevent further processing. And this rule must go before your more general rule.Reference: