In accordance with the SEO guidelines I am changing pages url from
website.com/color_red/
(underscore) to
website.com/color-red/
(dash / hyphen)
/color-red/ must simply produce ?c=red
In .htaccess this works perfectly with underscore:
RewriteRule ^color_([^/.]+)/?$ ?c=$1 [L]
not with dash:
RewriteRule ^color-([^/.]+)/?$ ?c=$1 [L]
I think dash char must be escaped but I don’t know how.
2
Answers
A simple solution is to escape the hypen/dash char
-
with square brackets[-]
:Could you please try following. Please make sure to clear your browser cache before testing your URLs.
1st solution: To handle both
_
OR-
in your URLs then try following.2nd solution: In case you only want to handle
-
in your URLs then try following.