GET變量我使用WordPress的永久鏈接結構類別%%/%postname%/與下面的htaccess:改寫URL
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
URL的採取的形式http://www.example.com/category/postname/。我有一個插件,如果您將?m=gallery
附加到URL,它會將您帶到帖子的畫廊。所以http://www.example.com/category/postname/?m=gallery
帶你到畫廊。我希望能夠使用http://www.example.com/category/postname/gallery/
代替。我需要修改什麼才能達到我想要的效果?我會想象它會是這樣的RewriteRule ^(.+)/gallery$ $1?m=gallery
編輯 - 當前的htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase/
RewriteRule ^index\.php$ - [L]
RewriteRule ^(.+)/gallery/$ $1/?m=gallery [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
是有道理的,但它似乎沒有工作。你認爲WordPress正在做些什麼? – v0idless
一個接一個的嘗試:1)將'QSA'添加到最後一個規則:'RewriteRule。 /index.php [QSA,L]'2)向答案中的規則添加'L'標誌3)如果仍然沒有,並且你完全控制Apache(可以編輯配置文件),那麼啓用重寫調試('RewriteLogLevel 9 '),請重新啓動httpd並查看重寫日誌(嘗試訪問此URL後) - 它應該向您顯示錯誤的位置。 – LazyOne