所以我的链接是这样的:
http://abcdefgh.com/index?site=XXXX
http://abcdefgh.com/index?category=YYYY
http://abcdefgh.com/index?category=YYYY&site=XXXX
我想隐藏查询字符串,用户应查看以下链接:
http://abcdefgh.com/index/site/XXXX
http://abcdefgh.com/index/category/YYYY
http://abcdefgh.com/index/category/YYYY/site/XXXX
我确实尝试过同一主题的先前问题的所有答案,但它不起作用。帮助我.htaccess代码
答案 0 :(得分:1)
您可以在.htaccess
中使用此代码作为您的网址http://abcdefgh.com/XXXX
RewriteEngine On
DirectoryIndex index.php
## RewriteCond Set here
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ index.php?site=$1 [QSA,L]