Mod rewrite, only letters, numbers and spaces need to be allowed
Since I need to allow my users to search for lines with spaces, I need to change this rewrite rule (lighttpd engine).
"^/(results)/(query)/([0-9a-zA-Z_]+)$" => "index.php?action=results&query=$3",
Allow only letters, numbers and spaces (I think it only needs the data it needs to find some data from MySQL).
Thanks in advance.
0
source to share
1 answer
Regular expression space \s
"^/(results)/(query)/([0-9a-zA-Z_\s]+)$" => "index.php?action=results&query=$3"
or
"^/(results)/(query)/([\w\d\s_]+)$" => "index.php?action=results&query=$3"
If a character is required -
, it must be the first in the range
"^/(results)/(query)/([-0-9a-zA-Z_\s]+)$" => "index.php?action=results&query=$3"
See the lighttpd wiki basics and the complete regex reference .
+2
source to share