How can I fix my WordPress Permalinks?

Posted in :

如果你的wordpress 搬家,從主機A 搬到主機B, 新的主機可能沒有設定正確,會造成「自定網址」的功能會不能運作,如果是在 ubuntu 滿簡單的,執行一下這指令即可。

1.) Make sure you have enabled mod_rewrite in apache. This can be done by running:

a2enmod rewrite

and then restarting apache

service apache2 restart

如果是在 centos 沒有 a2enmod 指令,也只需要在 .conf 裡增加下列紅字的部份:

<VirtualHost *:80>
ServerAlias XXX.com
ServerAdmin XXX
DocumentRoot /var/www/html/XXX.com/
ServerName www.XXX.com
DirectoryIndex index.html index.php
<Directory "/var/www/html/www.XXX.com/">
    allow from all
    Options -Indexes
    AllowOverride All
</Directory>
CustomLog ${APACHELOGDIR}/XXX.log common
ErrorLog ${APACHELOGDIR}/XXX-error.log

</VirtualHost>

發佈留言

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