Forum Moderators: phranque

Message Too Old, No Replies

Adding a Hyphen to a URL

hyphen replacing space url

         

mattennant

7:09 pm on Nov 10, 2007 (gmt 0)

10+ Year Member



hi there
am a real noob to this mod_rewrite world, but enjoying a few successful results. I have successfully re written my dynamic url, below

RewriteRule ^Products/([a-z]+)$ Products/index.php?RecordID=$1

which is great if my variable in the database is for example eg. producthome

if i change the variable to product-home the page is not found.

I'm sure this is something simple but have had a poke around the net and found nothing so far.

Any help much appreciated

jdMorgan

9:10 pm on Nov 10, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Add a literal hyphen ( escaped with a "\" ) to the range of allowed characters in your pattern:

^Products/([a-z\-]+)$

Jim

mattennant

1:03 am on Nov 11, 2007 (gmt 0)

10+ Year Member



thanks jim
that sorted it
many thanks