APMServ下wordpress配置偽靜態的方法
來源:程序員人生 發布時間:2014-03-17 07:13:40 閱讀次數:3491次
在本地調試的wordpress在跳轉頁面的時候出現如下錯誤代碼:
Object not found!
The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.
If you think this is a server error, please contact the webmaster.
Error 404
192.168.1.1
12/09/09 03:58:41
Apache/2.2.9 (APMServ) mod_ssl/2.2.9 OpenSSL/0.9.8h PHP/5.2.6
只能正常顯示主頁,絕對路徑的文件也訪問正常,但是只要是點擊主頁上的鏈接都連接失敗,顯示上述錯誤代碼。在還原WordPress和數據庫后,找到出現錯誤的原因,我在wordpress后臺設置中的固定鏈接中使用了靜態頁面,以至于Apache不能正常解析。
要讓wordpress成功使用靜態化頁面我們就要在APMServ中啟用支持靜態頁面解析功能。我的APMServ版本為5.2.6,下面就以5.2.6版本為例描述我解決的方法。
首先打開你的APM的安裝目錄,找到 APMServ5.2.6Apacheconfhttpd.conf,為防止意外最好在修改前先備份一個。
注意:打開這類文本編輯文件最好用editplus,notepad++等專業編輯器來編輯,不能用記事本,否則保存后會有編碼問題,切記。
找到以下這段文字
#APMServ默認虛擬主機
NameVirtualHost *:80
<VirtualHost *:80>
ServerName *
DocumentRoot "F:/mihuashu/APMServ5.2.6/www/htdocs"
<Directory "F:/mihuashu/APMServ5.2.6/www/htdocs">
Options FollowSymLinks IncludesNOEXEC Indexes
DirectoryIndex index.html index.htm default.htm index.php default.php index.cgi default.cgi index.pl default.pl index.shtml
AllowOverride Options FileInfo
Order Deny,Allow
Allow from all
</Directory>
</VirtualHost>
修改為
#APMServ默認虛擬主機
NameVirtualHost *:80
<VirtualHost *:80>
ServerName *
DocumentRoot "F:/mihuashu/APMServ5.2.6/www/htdocs"
<Directory "F:/mihuashu/APMServ5.2.6/www/htdocs">
Options FollowSymLinks IncludesNOEXEC Indexes
DirectoryIndex index.html index.htm default.htm index.php default.php index.cgi default.cgi index.pl default.pl index.shtml
AllowOverride Options FileInfo
Order Deny,Allow
Allow from all
</Directory>
RewriteEngine On
RewriteRule ^(.*)/archiver/([a-z0-9-]+.html)$ $1/archiver/index.php?$2
RewriteRule ^(.*)/forum-([0-9]+)-([0-9]+).html$ $1/forumdisplay.php?fid=$2&page=$3
RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+).html$ $1/viewthread.php?tid=$2&extra=page\% 3D$4&page=$3
RewriteRule ^(.*)/profile-(username|uid)-(.+).html$ $1/viewpro.php?$2=$3
</VirtualHost>
然后保存,重啟APMServ使之生效,這時候就會發現我們的WordPress完美支持靜態化頁面了。
生活不易,碼農辛苦
如果您覺得本網站對您的學習有所幫助,可以手機掃描二維碼進行捐贈