Click here to Skip to main content
15,889,200 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a URL like this
http://www.freshupnow.com/movie.php?moviename=A+Flat

I want to rewrite this URL using .htaccess code like this
http://www.freshupnow.com/movies/A+Flat

So, I have used the following code for this
RewriteRule ^movies/([A-Za-z0-9-]+)/?$ movie.php?moviename=$1 [NC,L]


Can Some one please verify it, Either it is Right or Wrong?
Posted
Updated 29-Oct-11 6:35am
v2

1 solution

([A-Za-z0-9-]+) should be ([A-Za-z0-9\+])+ coz you want to capture the whole group 1 or more times and you also want to allow "+" character in your movie names, as in the example "A+Flat". You can validate your regex yourself using this online tool: Regex Validate[^]. There are several others, try Googling for it.
 
Share this answer
 
Comments
rashidfarooq 30-Oct-11 0:20am    
Thanks for answering.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900