0
的htaccess的規則,能不能請你幫得到這個工作 -特定類型的URL
http://domain.com/gallery/category/another/slug
到
http://domain.com/gallery/
如果URL中包含單詞gallery
不管是什麼的一部分,剩下的就將始終發送請求到http://domain.com/gallery/
http://domain.com/gallery/category/another/slug -> will hit http://domain.com/gallery/
http://domain.com/gallery/another/slug -> will hit http://domain.com/gallery/
http://domain.com/gallery/more/more/slug -> will hit http://domain.com/gallery/
目前我的現有.htaccess看起來是這樣的 -
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /site/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /site/index.php [L]
</IfModule>
# END WordPress
感謝您的回答。你可以看到我目前的.htaccess文件。我在RewriteRule行之前添加了'RewriteRule^gallery /.*/gallery/[L]'。 /site/index.php [L]'它顯示對象未找到!如果我添加'RewriteRule^gallery /.*/site/gallery/[L]',它會顯示內部服務器錯誤。你有什麼建議嗎? – HADI
是否存在 ?另外,'[L]'表示這應該是最後執行的規則。這可能是也可能不是你想要的。有關詳細信息,請參閱https://httpd.apache.org/docs/2.0/mod/mod_rewrite.html或https://httpd.apache.org/docs/2.0/misc/rewriteguide.html –
Amanda
yes domain.com/gallery exists ,我只想顯示domain.com/gallery頁面內容,如果用戶點擊domain.com/gallery或domain.com/gallery/more或domain.com/gallery/more/slug – HADI