Friday, April 26, 2024

WordPress固定鏈接的htaccess文件設置

WordPress設置固定鏈接時,如果提示需要設置.htaccess文件,可使用文本編輯器新建一個文本,內容如下:

# BEGIN WordPress

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L] </IfModule>

# END WordPress

直接保存為.htaccess文件,上傳到網站的WordPress目錄中即可(與index.php同目錄)。

重要提示:
上文代碼中第三行的 /blog/和第六行的 /blog/index.php請根據你自己WordPress的實際安裝目錄進行修改,否則會出錯。

One comment

  1. 這個設置的確比較頭痛,如果有什麼插件可以實現就好了。

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.