一、nginx伪静态设置:
nginx下Wordpress固定链接的伪静态规则其实特别简单,在nginx配置文件nginx.conf的location段添加一行就OK。
1. 打开nginx配置文件:
# vim /etc/nginx/nginx.conf(此路径根据Linux版本与安装路径会有不同)
2. 在server容器中添加下面这几行
location /
{
try_files $uri $uri/ /index.php?q=$uri&$args;
}
3. 重新加载nginx配置文件
# /etc/init.d/nginx reload
完成设置。
二、apache伪静态设置:
1. 检查/etc/httpd/conf/httpd.conf中是否rewrite模块:
LoadModule rewrite_module libexec/mod_rewrite.so
2. 检查Apache是否开启.htaccess支持:
AllowOverride All
(默认在httpd.conf文件的338行)
这部分详细配置如下:
<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生效。
刚刚按照你的伪静态规则设置了一下。成功了。谢谢啦!
不客气~~
hi,我使用了vps和cos-html-cache以及inove主题,但是搜索不管用了,可以帮我写写静态化么?
cos-html-cache这个插件我没用过,可能不一样~~
您好,我按照您的设置,还是不对,是wordpress刚刚装好的
可以的,你可能放错地方了!
设置成功,非常感谢!
请问遇到过没有网页返回404很慢的情况呢?
就是访问一个不存在的页面,后台已经是404了。但是前台一直是等待服务器响应的状态。。
请教 如果wordpress要是放在子目录,怎么办呢?
例如 /home/wwwroot/www.xxx.com/blog
设置成功,谢谢啦!
帮我大忙啦.
测试成功,但是不知道是什么原理?