View Single Post
  #6 (permalink)  
Old 11-26-2008, 06:36 PM
wige's Avatar
wige wige is offline
Moderator
WebProWorld Moderator
 
Join Date: Jun 2006
Location: United States
Posts: 2,651
wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9
Default Re: Search engine friendly urls

Try:

RewriteRule ^/services/([a-zA-Z0-9\-]*)$ /services.php?id=$1 [L]

The dash is a reserved character and usually needs to be escaped with a backslash.

You also still need to have the parentheses. That is how mod_rewrite knows which part of the original string to use to replace the $1.

Also, you need to tell mod_rewrite how many characters to match. The brackets will only match a single character that matches the range of possible characters listed. Adding the asterisk after the closing bracket tells it to match as many characters as there are.
__________________
The best way to learn anything, is to question everything.

Last edited by wige; 11-26-2008 at 06:39 PM.
Reply With Quote