regex - How to use parse special characters literally in Apache rewrite rule? -
so have apache rewrite rule:
rewriterule ^news.php?viewstory=([0-9]+)$ index.php?page=news&viewstory=$1
it's needed i'm changing structure of website, , need take account old structure.
it works correctly, apart 1 thing. need parse ? character middle part (^news.php?...
) literally - not take special character. want other special characters work normally.
what's correct way this? can't find working solutions anywhere.
you can't use query string way. need use query string in condition check if there. use captured backreference in rule. let me know how works you.
rewriteengine on rewritecond %{query_string} ^viewstory=([0-9]+)$ rewriterule ^news\.php$ index.php?page=news&viewstory=%1 [r=301,l]
Comments
Post a Comment