公司第一個網站內容是以英文為主,且文章、頁面皆以英文命名。
而一般網址都會建議以自定義英文名、或直接抓取標題來命名(忌中文命名)
若直接修改固定網址,可能會造成404
需先修改nginx設定,如下

#vim /etc/nginx/conf.d/wordpress.conf (我的是放在這裡)

location / {
         加入這段 try_files $uri $uri/ /index.php?$args;
}
#systemctl reload nginx
完成

用apache的話修改.htaccess

#vim /var/www/html/.htaccess
加入
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

參考出處:
Nginx 設定 WordPress Rewrite 固定連結
11 個強化 WordPress 網站安全的 .Htaccess 設定技巧

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *