FourMat
asked on
mod_rewrite Replace Underscores with hyphens in URL
Hello,
I have a RewriteRule that currently modifies a URL to be more SEO friendly
RewriteRule ^(.*)-c-(.*).html$ index.php?cPath=$2&%{QUERY _STRING}
rule above will take this url and modify it
index.php?cPath=277_280
which would result in something like this:
replacement-parts-c-277_28 0_295.html
I need it to look like this:
replacement-parts-c-277-28 0-295.html
what Is for the above Rewrite rule to also replace the underscore with a dash. I have attempted several changes, but I'm failing at regex syntax. Is there a way to do this within the one rule above?
I have a RewriteRule that currently modifies a URL to be more SEO friendly
RewriteRule ^(.*)-c-(.*).html$ index.php?cPath=$2&%{QUERY
rule above will take this url and modify it
index.php?cPath=277_280
which would result in something like this:
replacement-parts-c-277_28
I need it to look like this:
replacement-parts-c-277-28
what Is for the above Rewrite rule to also replace the underscore with a dash. I have attempted several changes, but I'm failing at regex syntax. Is there a way to do this within the one rule above?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
David, and Terry, thanks for the responses. I haven't had a chance to test these ideas (got pulled away on another project briefly) but will definitely be back on it soon and test, thanks!
I'm guessing not, but I wanted to check.