技术支持 常见问题 应用软件类常见问题 Apache 中 wordpress 伪静态的配置
Apache 中 wordpress 伪静态的配置
** 首先确定Apache是否加载了Mod_rewrite 模块** 检查 httpd.conf 文件中是否有以下代码
LoadModule rewrite_module libexec/mod_rewrite.so
AddModule mod_rewrite.c
** 检查 Apache 是否开启 .htaccess 支持 **
vi /etc/httpd/conf/httpd.conf
AllowOverride All #如果后面参数为 None 需要修改为 All (大概在338行)
在文件 /etc/httpd/conf/httpd.conf 相应的主机目录配置中加入如下代码(此时须注意,如果网站是通过虚拟主机来定义,请务必加到虚拟主机配置中去,否则可能无法使用。)
RewriteEngine On
RewriteBase /
RewriteRule
index\.php$ - L
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php L
vi /etc/httpd/conf/httpd.conf #编辑
<Directory "/var/www/html">
Options Includes ExecCGI FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
< IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule
index\.php$ - L
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php L
< /IfModule>
< /Directory>
** 重启 Apache**
/etc/init.d/httpd restart
** 设置 WordPress** 在 WordPress 后台-设置-固定链接-自定义结构,输入下面的代码,最后保存更改即可。
/archives/NaV.html