Using spaces in URL and .htaccess

前端 未结 2 1730
深忆病人
深忆病人 2021-01-13 03:51

I wrote a local name/phone/address search engine for my city.

Users must be able to quick-access the results by going to either of these urls:

相关标签:
2条回答
  • 2021-01-13 04:00
    RewriteRule ^([A-Za-z-\s]+)/([A-Za-z-\s]+)$ /index.php?lastname=$1&name=$2 [QSA,L]
    

    The \s will take care of blank spaces.

    0 讨论(0)
  • 2021-01-13 04:21

    Can you try this? ([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]
    
    0 讨论(0)
提交回复
热议问题