4

我希望它将 url 显示 /index.php?page=somePage&id=someID&siteAddress=someAddress/someAddress/?page=somePage&id=someID.

我该如何使用重写规则呢?

4

1 回答 1

0

在内部将/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]
于 2012-10-16T03:21:55.347 回答