我正在使用此代碼阻止帶有單詞的 URLfoo
RewriteEngine On
RewriteRule ^foo - [F]
它作業正常,但是,如何使它與下面的 WP 中現有的 .htaccess 代碼一起作業?
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
uj5u.com熱心網友回復:
這只是將規則放在WordPress 代碼塊之前的一個例子。
例如:
# Block all URLs that start with "/foo"
RewriteRule ^foo - [F]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
另請參閱我對 WordPress SE 網站上以下問題的回答,如果您仍然遇到問題,請參閱該問題的詳細資訊:
- https://wordpress.stackexchange.com/questions/376875/blocking-access-to-all-post-tag-uris-via-htaccess
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/482667.html
