20、wordpress博客url静态化
20.1 wordpress没有实现伪静态时的网页:
20.2进入wordpress后台:
1、设置
2、固定链接
3、自定义链接
/archives/%post_id%.html #%post_id%是数据库对应博文内容对应唯一的id,例如122;
20.3 修改nginx配置文件:
[root@web01 extra]# pwd
/application/nginx/conf/extra
[root@web01 extra]# vim php.conf
server {
listen 172.16.1.8:80;
server_name www.php.com;
location / {
root html/php/;
index index.php index.html;
if (-f $request_filename/index.php){#如果请求的网页存在index.php则跳转到index.php;
rewrite (.*) $1/index.php;
}
if (-f $request_filename/index.html){#如果请求的网页存在index.html存在则跳转到index.html;
rewrite (.*) $1/index.html;
}
if (!-f $request_filename){#如果请求的网页不存在则跳转到index.php;
rewrite (.*) /index.php;
}
#说明,上面的配置是由程序内部实现的,不必深究;
}
location ~ .*\.(php|php5)?$ {
root html/php/;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
[root@web01 nginx]# sbin/nginx -t
nginx: the configuration file /application/nginx-1.8.1/conf/nginx.conf syntax is ok
nginx: configuration file /application/nginx-1.8.1/conf/nginx.conf test is successful
[root@web01 nginx]# sbin/nginx -s reload
20.1 访问测试:
网页变成了伪静态页面;
最新文章
- ubuntu 启动MySql和安装python的MySQLdb模块
- console对象-转
- 转: JAVA递归算法实例小结
- Linux vim命令
- fir.im Weekly - 聊聊让人向往的远程开发工作
- 使用SQLAlchemy对Firebird数据库进行操作
- 转:EF调用存储过程、函数
- 系统自带.net版本
- statusBarOrientation设备状态
- QTabWidget添加自定义样式
- Android使用Eclipse遇到";java.lang.ClassNotFoundException";
- js重点--this关键字
- Vue学习5:条件渲染
- My_SQ主键,外键
- laravel5.3安装redis扩展包
- Linux命令之cp
- [转]bus error与segment error
- Caused by: java.io.IOException: Added a key not lexically larger than previous.
- slice,substr和substring方法的区别
- awk的简单使用
热门文章
- [Qt] 《开发指南》samp4.1 源码分析
- QT windows 应用程序 exe ,设置详细信息并解决中文乱码问题
- 华为eNSP模拟器— telnet实验
- Linux_源码安装包管理理论概述
- nvm、nrm、npm 安装和使用详解
- Redis学习笔记八:集群模式
- php代码审计之命令执行中windows/linux的差异化问题
- Runtime PM 处理不当导致的 external abort on non-linefetch 案例分享
- python报错“AttributeError: 'set' object has no attribute 'items'“
- java中存储mysql数据库时间类型【date、time、datetime、timestamp】