全球主机交流论坛

标题: 请教下wordpress 301重定向问题 [打印本页]

作者: icel    时间: 2012-3-7 22:39
标题: 请教下wordpress 301重定向问题
本帖最后由 icel 于 2012-3-7 22:42 编辑

我在www.name.com.conf的server下添加了下面的信息:
  1. if ($host !='www.name.org'){
  2. rewrite ^/(.*)$ http://www.name.org/$1 permanent;
  3. }
复制代码
但是重启nginx一直提示错误
nginx: [emerg] invalid condition "$host" in /usr/local/nginx/conf/vhost/www.name.org.conf:5
nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed
nginx: [emerg] invalid condition "$host" in /usr/local/nginx/conf/vhost/www.name.org.conf:5

哪里错了?
作者: cnweb    时间: 2012-3-7 22:40
有现成的啊
作者: vagaa    时间: 2012-3-7 22:41
WordPress 应该有个帮助文件吧
作者: icel    时间: 2012-3-7 22:41
cnweb 发表于 2012-3-7 22:40
有现成的啊

我就是在网上找的教程...查看了没有哪里不一样,但是重启nginx就提示上面的错误。
作者: master    时间: 2012-3-7 22:42
不对哦
作者: icel    时间: 2012-3-7 22:43
master 发表于 2012-3-7 22:42
不对哦

重定向问题,写错了
作者: 副站长    时间: 2012-3-7 22:46
WP不是本身就有301重定向吗?
作者: icel    时间: 2012-3-7 22:48
副站长 发表于 2012-3-7 22:46
WP不是本身就有301重定向吗?

额。。是不带www跳转到www这种的
作者: UCVPS    时间: 2012-3-7 22:52
写错鸟
作者: UCVPS    时间: 2012-3-7 22:53
  1. server
  2.         {
  3.                 listen     80;
  4.                 server_name xxx.com;
  5.                 index index.html index.htm index.php default.html default.htm default.php;
  6.                 rewrite ^(.*) https://www.$server_name$1 permanent;
  7.                 include none.conf;
  8.                 location ~ .*\.(php|php5)?$
  9.                         {
  10.                                 fastcgi_pass  unix:/tmp/php-cgi.sock;
  11.                                 fastcgi_index index.php;
  12.                                 include fcgi.conf;
  13.                         }

  14.                 location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
  15.                         {
  16.                                 expires      30d;
  17.                         }

  18.                 location ~ .*\.(js|css)?$
  19.                         {
  20.                                 expires      12h;
  21.                         }

  22.                 access_log off;
  23.         }
复制代码

作者: icel    时间: 2012-3-7 23:19
UCVPS 发表于 2012-3-7 22:53

好像还是不行,我再试试!




欢迎光临 全球主机交流论坛 (https://lilynana.eu.org/) Powered by Discuz! X3.4