实现APMServ5.2.6支持静态化页面


小黑工作站

在本地调试的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完美支持静态化页面了。

相关内容

    暂无相关文章