I wrote a local name / phone / address search system for my city.
Users should be able to quickly access results by going to any of these URLs:
This is my current .htaccess config:
# Smart links RewriteRule ^([0-9]+)$ /html/index.php?phone=$1 [QSA,L] RewriteRule ^([A-Za-z-]+)$ /html/index.php?lastname=$1 [QSA,L] RewriteRule ^([A-Za-z-]+)/([A-Za-z-]+)$ /html/index.php?lastname=$1&name=$2 [QSA,L]
This works very well, unless the user includes a space in the name and / or name. In addition, no numbers can be used when searching for names.
Any ideas on how to resolve spaces in the url? Thank!
? ([a-z-\s]+)
([a-z-\s]+)
RewriteRule ^([0-9]+)$ /html/index.php?phone=$1 [QSA,L] RewriteRule ^([A-Za-z-\s]+)$ /html/index.php?lastname=$1 [QSA,L] RewriteRule ^([A-Za-z-\s]+)/([A-Za-z-\s]+)$ /html/index.php?lastname=$1&name=$2 [QSA,L]
RewriteRule ^([A-Za-z-\s]+)/([A-Za-z-\s]+)$ /index.php?lastname=$1&name=$2 [QSA,L]
\ s .
Source: https://habr.com/ru/post/1789340/More articles:mysql - how do I get a list starting with a letter and continue with the following letters? - mysqlHow can we embed artificial intelligence in javascript games? - javascriptStack-based maze exploration - c ++Best Practice for Progress Bar in Python PyGTK - pythonRewrite (translate) the page portion of a URL in Wordpress - wordpressResizing photos as thumbnails such as Flickr and Facebook photostreams? - facebookThe specified module could not find the error on the virtual machine hosting the website - asp.netHow can I determine if a 404'd site is in javascript and then redirect the browser to another location - javascript.net Rx: batch processing ok - c #alternative to statscm - mavenAll Articles