Forum Moderators: phranque
Options +FollowSymlinks
RewriteEngine On
rewriterule ^product/(.*).htm$ product.php?PID1=$1
[mysite...] translates to [mysite...]
My problem is sometimes the product will have a space in it.
Eaxmple [mysite...] widget.htm
I dont want to use %20 when a space appears in the product. Instead I want to use a - but then have the rewrite rule replace the - with %20.
So for example the following [mysite...] would translate to [mysite...]
I would appreciate if anybody can advise on how this can be done.
You can replace - with %20 using RewriteRule.
It's easy if you know the maximum number of - in the URL.
But it can complicate your life and make debugging difficult.
If you insist, add this line:
rewriterule ^product/([^-]+)-(.*).htm$ product/$1\ $2.html [L]
before this rule:
rewriterule ^product/(.*).htm$ product.php?PID1=$1 [L]
and it should translate at last several hyphens.
If it fails, you may want to try this:
rewriterule ^product/([^-]+)-(.*).htm$ product/$1%20$2.html [L,NE]