xiaoc68 发表于 2014-7-3 22:21:12

wordpress地图重写规则问题

用Yoast WordPress SEO插件里的地图报错 如下:
As you're on NGINX, you'll need the following rewrites:

rewrite ^/sitemap_index\.xml$ /index.php?sitemap=1 last;
rewrite ^/([^/]+?)-sitemap(+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;



用Google XML Sitemaps插件里的地图报错 如下:
rewrite ^/sitemap(-+(+))?\.xml$ "/index.php?xml_sitemap=params=$2" last;
rewrite ^/sitemap(-+(+))?\.xml\.gz$ "/index.php?xml_sitemap=params=$2;zip=true" last;
rewrite ^/sitemap(-+(+))?\.html$ "/index.php?xml_sitemap=params=$2;html=true" last;
rewrite ^/sitemap(-+(+))?\.html.gz$ "/index.php?xml_sitemap=params=$2;html=true;zip=true" last;

请问重写规则应放在那个文件里 wordpress.conf? nginx.conf?

licess 发表于 2014-7-4 09:23:54

wordpress.conf

xiaoc68 发表于 2014-7-16 20:58:07

添加上去,然后重启lnmp还是没反应
location / {
if (-f $request_filename/index.html){
                rewrite (.*) $1/index.html break;
      }
if (-f $request_filename/index.php){
                rewrite (.*) $1/index.php;
      }
if (!-f $request_filename){
                rewrite (.*) /index.php;
      }
}

rewrite /wp-admin$ $scheme://$host$uri/ permanent;
rewrite ^/sitemap_index\.xml$ /index.php?sitemap=1 last;
rewrite ^/([^/]+?)-sitemap(+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;


不是这样吗
页: [1]
查看完整版本: wordpress地图重写规则问题