matching %20 character in the URIs
Moderator: General Moderators
matching %20 character in the URIs
What regular expression i need to match the /hello%20world part in http://www.domain.com/hello%20world ?
- n00b Saibot
- DevNet Resident
- Posts: 1452
- Joined: Fri Dec 24, 2004 2:59 am
- Location: Lucknow, UP, India
- Contact:
basename() can do this trick for you easily i think...
Yes, because i have already made it possible to access member profiles in a community site just when you type the user name after the domain -
http://domain.com/username and RewriteRule /([a-z9-0_-])$ /profile.php?name=$1
But if the user name contains space for example domain.com/user name this looks like domain.com/user%20name and the above regexp patern cannot detect the % character.
What patern i need to match the space in the user name ?
http://domain.com/username and RewriteRule /([a-z9-0_-])$ /profile.php?name=$1
But if the user name contains space for example domain.com/user name this looks like domain.com/user%20name and the above regexp patern cannot detect the % character.
What patern i need to match the space in the user name ?
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
Code: Select all
RewriteRule /(.+)$ /profile.php?name=$1That is not a solution, will cause internal server error because the rewrite rule will match on every request even the request after the rule (profile.php?name= alsow will triger redirection).feyd wrote:possibly.Code: Select all
RewriteRule /(.+)$ /profile.php?name=$1
It should match exactly a-z A-Z 0-9 - _ %, which will allow opening URIs like file.php (the dot will not match) or subdirectories /subdir/, because the second slash also will not match.
But what should be the pattern ?