目前.htaccess文件显示为:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
我要做的是路由所有子页面流量
/record-detail/what-ever-record
为:
/record-detail/?record_id=what-ever-record
考虑到已经有一条规则将所有网址路由到index.php。
答案 0 :(得分:0)
只需在其他wordpress规则之前添加规则即可。
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#RewriteRule ^record-detail/([^/]+)/?$ record-detail/?record_id=$1 [QSA,L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_URI} !^/record-detail [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [QSA,L]
</IfModule>
# END WordPress