我希望它将 url 显示
/index.php?page=somePage&id=someID&siteAddress=someAddress
为
/someAddress/?page=somePage&id=someID
.
我该如何使用重写规则呢?
我希望它将 url 显示
/index.php?page=somePage&id=someID&siteAddress=someAddress
为
/someAddress/?page=somePage&id=someID
.
我该如何使用重写规则呢?
在内部将/someAddress重写为/index.php :
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{QUERY_STRING} ^page=([^&]+)&id=([^&]+)$
RewriteRule ^/?([^/]+)/$ /index.php?page=%1%id=%2&siteAddress=$1 [L]
外部重定向/index.php到/someAddress:
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\?page=([^&]+)&id=([^&]+)&siteAddress=(^[&\ ]+)
RewriteRule ^ /%3/?page=%1&id=%2 [L,R=301]