这些年来我经常使用 mod_rewrite 规则,这更让我不明白为什么这不起作用:
RewriteRule ^cottage/house/(.*)/(.*)$ /cottage/house/$1?query=$2 [L]
我将它与以下 .htaccess 文件一起使用:
RewriteEngine On
Rewritecond %{HTTP_HOST} !^www\.website\.com
RewriteRule (.*) http://www.website.com/$1 [R=301,L]
RewriteBase /
RewriteRule ^index\.php$ - [L]
# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
此代码应该使格式的 URL/cottage/house/housename/about
转到/cottage/house/housename?query=about
...任何想法将不胜感激。