我正在尝试编辑 mt .htaccess 重写 url。
这是我的网址: http://www.indojamtangan.com/jamtanganoriginal/Alexandre%20Christie
Alexandre Christie 是我的品牌参数。我想将我的 .htaccess 网址设置为 http://www.indojamtangan.com/jamtanganoriginal/Alexandre-Christie 。我想用 - 替换 %20 。我已经尝试了 Stackoverflow 上其他主题的所有代码,但一切都不起作用。
这是我的 htaccess :
RewriteCond %(REQUEST_FILENAME) !-f
RewriteCond %(REQUEST_FILENAME) !-d
RewriteRule ^brand/([a-z0-9/s]+)$ /brand.php?brand=$1 [L]
我应该修改哪些代码才能实现我的目标?
谢谢
最佳答案
希望这对您有用。
RewriteEngine On
RewriteCond %{THE_REQUEST} ^(GET|POST)\ /(.*)/(.*)\.php\?cat_type=(.*)&location=(.*)%(.*)\ HTTP
RewriteRule ^ http://your_domain.com/%3/%4/%5-%6? [R=301,L]
RewriteCond %{THE_REQUEST} ^(GET|POST)\ /(.*)/(.*)\.php\?location=(.*)%(.*)\ HTTP
RewriteRule ^ http://your_domain.com/%3/%4-%5? [R=301,L]
关于php - .Htaccess Url 重写将 %20(空格)替换为 "-",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48396086/