当前位置:首页 > CMS教程 > WordPress > 列表

nginx下wordpress子目录伪静态设置步骤详解

发布:smiling 来源: PHP粉丝网  添加日期:2015-10-16 11:33:48 浏览: 评论:0 

子目录伪静态可以让我们不带参数并显示为目录或html了,这样有利于搜索引擎对网站的抓取了,下面我们来看一些例子.

网站访问目录为http://show.abc.com/,但是wordpress是装在他下面的manage目录中的,所以访问到的首页也该是http://show.abc.com/manage/

而wordpress默认访问文章的URL是http://show.abc.com/manage/?p=12 的形式,需要做伪静态使文章访问形式为http://show.abc.com/manage/12

在nginx中配置如下:

  1. server { 
  2. listen  80; 
  3. server_name     show.phpfensi.com; 
  4. access_log      logs/access_show.abc.com.log; 
  5. error_log       logs/error_show.abc.com.log; 
  6.  
  7. index   index.html index.php; 
  8.  
  9. location / { 
  10.         root    /web/html/show; 
  11. } 
  12.  
  13. location /manage/ { 
  14.         try_files $uri $uri/ /manage/index.php; 
  15. } 
  16.  
  17. location /manage/wp-content { 
  18.         alias   /web/html/show/manage/wp-content; 
  19. } 
  20. location /manage/wp-includes { 
  21.         alias   /web/html/show/manage/wp-includes; 
  22. } 
  23. location /manage/wp-admin { 
  24.         alias   /web/html/show/manage/wp-admin; 
  25. }  
  26.  
  27. location ~ \.php$ { 
  28.         root           /web/html/show; 
  29.         fastcgi_pass   127.0.0.1:9001; 
  30.         fastcgi_param  SCRIPT_FILENAME  /web/html/show$fastcgi_script_name; 
  31.         include        fastcgi_params; 
  32. } 
  33. }

Tags: nginx子目录 wordpress伪静态

分享到: