5个月前 (03-02)  datalife cms |   抢沙发  114 
文章评分 0 次,平均分 0.0
<code class="javascript"># Redirects
rewrite ^<span class="regexp">/page/</span>(.*)$ /index.php?cstart=$<span class="number">1</span> last;

# Post
rewrite ^<span class="regexp">/([0-9]+)/</span>([<span class="number">0</span>-<span class="number">9</span>]+)/([<span class="number">0</span>-<span class="number">9</span>]+)/page,([<span class="number">0</span>-<span class="number">9</span>]+),([<span class="number">0</span>-<span class="number">9</span>]+),(.*).html(<span class="regexp">/?)+$ /i</span>ndex.php?subaction=showfull&amp;year=$<span class="number">1</span>&amp;month=$<span class="number">2</span>&amp;day=$<span class="number">3</span>&amp;news_page=$<span class="number">4</span>&amp;cstart=$<span class="number">5</span>&amp;news_name=$<span class="number">6</span> last;
rewrite ^<span class="regexp">/([0-9]+)/</span>([<span class="number">0</span>-<span class="number">9</span>]+)/([<span class="number">0</span>-<span class="number">9</span>]+)/page,([<span class="number">0</span>-<span class="number">9</span>]+),(.*).html(<span class="regexp">/?)+$ /i</span>ndex.php?subaction=showfull&amp;year=$<span class="number">1</span>&amp;month=$<span class="number">2</span>&amp;day=$<span class="number">3</span>&amp;news_page=$<span class="number">4</span>&amp;news_name=$<span class="number">5</span> last;
rewrite ^<span class="regexp">/([0-9]+)/</span>([<span class="number">0</span>-<span class="number">9</span>]+)/([<span class="number">0</span>-<span class="number">9</span>]+)/print:page,([<span class="number">0</span>-<span class="number">9</span>]+),(.*).html(<span class="regexp">/?)+$ /</span>engine/print.php?subaction=showfull&amp;year=$<span class="number">1</span>&amp;month=$<span class="number">2</span>&amp;day=$<span class="number">3</span>&amp;news_page=$<span class="number">4</span>&amp;news_name=$<span class="number">5</span> last;
rewrite ^<span class="regexp">/([0-9]+)/</span>([<span class="number">0</span>-<span class="number">9</span>]+)/([<span class="number">0</span>-<span class="number">9</span>]+)/(.*).html(<span class="regexp">/?)+$ /i</span>ndex.php?subaction=showfull&amp;year=$<span class="number">1</span>&amp;month=$<span class="number">2</span>&amp;day=$<span class="number">3</span>&amp;news_name=$<span class="number">4</span> last;

rewrite ^<span class="regexp">/([^.]+)/</span>page,([<span class="number">0</span>-<span class="number">9</span>]+),([<span class="number">0</span>-<span class="number">9</span>]+),([<span class="number">0</span>-<span class="number">9</span>]+)-(.*).html(<span class="regexp">/?)+$ /i</span>ndex.php?newsid=$<span class="number">4</span>&amp;news_page=$<span class="number">2</span>&amp;cstart=$<span class="number">3</span>&amp;seourl=$<span class="number">5</span>&amp;seocat=$<span class="number">1</span> last;
rewrite ^<span class="regexp">/([^.]+)/</span>page,([<span class="number">0</span>-<span class="number">9</span>]+),([<span class="number">0</span>-<span class="number">9</span>]+)-(.*).html(<span class="regexp">/?)+$ /i</span>ndex.php?newsid=$<span class="number">3</span>&amp;news_page=$<span class="number">2</span>&amp;seourl=$<span class="number">4</span>&amp;seocat=$<span class="number">1</span> last;
rewrite ^<span class="regexp">/([^.]+)/</span>print:page,([<span class="number">0</span>-<span class="number">9</span>]+),([<span class="number">0</span>-<span class="number">9</span>]+)-(.*).html(<span class="regexp">/?)+$ /</span>engine/print.php?news_page=$<span class="number">2</span>&amp;newsid=$<span class="number">3</span>&amp;seourl=$<span class="number">4</span>&amp;seocat=$<span class="number">1</span> last;
rewrite ^<span class="regexp">/([^.]+)/</span>([<span class="number">0</span>-<span class="number">9</span>]+)-(.*).html(<span class="regexp">/?)+$ /i</span>ndex.php?newsid=$<span class="number">2</span>&amp;seourl=$<span class="number">3</span>&amp;seocat=$<span class="number">1</span> last;

rewrite ^<span class="regexp">/page,([0-9]+),([0-9]+),([0-9]+)-(.*).html(/</span>?)+$ /index.php?newsid=$<span class="number">3</span>&amp;news_page=$<span class="number">1</span>&amp;cstart=$<span class="number">2</span>&amp;seourl=$<span class="number">4</span> last;
rewrite ^<span class="regexp">/page,([0-9]+),([0-9]+)-(.*).html(/</span>?)+$ /index.php?newsid=$<span class="number">2</span>&amp;news_page=$<span class="number">1</span>&amp;seourl=$<span class="number">3</span> last;
rewrite ^<span class="regexp">/print:page,([0-9]+),([0-9]+)-(.*).html(/</span>?)+$ /engine/print.php?news_page=$<span class="number">1</span>&amp;newsid=$<span class="number">2</span>&amp;seourl=$<span class="number">3</span> last;
rewrite ^<span class="regexp">/([0-9]+)-(.*).html(/</span>?)+$ /index.php?newsid=$<span class="number">1</span>&amp;seourl=$<span class="number">2</span> last;

# For day
rewrite ^<span class="regexp">/([0-9]+)/</span>([<span class="number">0</span>-<span class="number">9</span>]+)/([<span class="number">0</span>-<span class="number">9</span>]+)(<span class="regexp">/?)+$ /i</span>ndex.php?year=$<span class="number">1</span>&amp;month=$<span class="number">2</span>&amp;day=$<span class="number">3</span> last;
rewrite ^<span class="regexp">/([0-9]+)/</span>([<span class="number">0</span>-<span class="number">9</span>]+)/([<span class="number">0</span>-<span class="number">9</span>]+)/page/([<span class="number">0</span>-<span class="number">9</span>]+)(<span class="regexp">/?)+$ /i</span>ndex.php?year=$<span class="number">1</span>&amp;month=$<span class="number">2</span>&amp;day=$<span class="number">3</span>&amp;cstart=$<span class="number">4</span> last;
# For all months
rewrite ^<span class="regexp">/([0-9]+)/</span>([<span class="number">0</span>-<span class="number">9</span>]+)(<span class="regexp">/?)+$ /i</span>ndex.php?year=$<span class="number">1</span>&amp;month=$<span class="number">2</span> last;
rewrite ^<span class="regexp">/([0-9]+)/</span>([<span class="number">0</span>-<span class="number">9</span>]+)/page/([<span class="number">0</span>-<span class="number">9</span>]+)(<span class="regexp">/?)+$ /i</span>ndex.php?year=$<span class="number">1</span>&amp;month=$<span class="number">2</span>&amp;cstart=$<span class="number">3</span> last;
# Output <span class="keyword">for</span> the entire year
rewrite ^<span class="regexp">/([0-9]+)(/</span>?)+$ /index.php?year=$<span class="number">1</span> last;
rewrite ^<span class="regexp">/([0-9]+)/</span>page/([<span class="number">0</span>-<span class="number">9</span>]+)(<span class="regexp">/?)+$ /i</span>ndex.php?year=$<span class="number">1</span>&amp;cstart=$<span class="number">2</span> last;
# Output <span class="keyword">for</span> tags
rewrite ^<span class="regexp">/tags/</span>([^<span class="regexp">/]*)(/</span>?)+$ /index.php?<span class="keyword">do</span>=tags&amp;tag=$<span class="number">1</span> last;
rewrite ^<span class="regexp">/tags/</span>([^<span class="regexp">/]*)/</span>page/([<span class="number">0</span>-<span class="number">9</span>]+)(<span class="regexp">/?)+$ /i</span>ndex.php?<span class="keyword">do</span>=tags&amp;tag=$<span class="number">1</span>&amp;cstart=$<span class="number">2</span> last;
# Output <span class="keyword">for</span> users
rewrite ^<span class="regexp">/user/</span>([^<span class="regexp">/]*)/</span>rss.xml$ /engine/rss.php?subaction=allnews&amp;user=$<span class="number">1</span> last;
rewrite ^<span class="regexp">/user/</span>([^<span class="regexp">/]*)(/</span>?)+$ /index.php?subaction=userinfo&amp;user=$<span class="number">1</span> last;
rewrite ^<span class="regexp">/user/</span>([^<span class="regexp">/]*)/</span>page/([<span class="number">0</span>-<span class="number">9</span>]+)(<span class="regexp">/?)+$ /i</span>ndex.php?subaction=userinfo&amp;user=$<span class="number">1</span>&amp;cstart=$<span class="number">2</span> last;
rewrite ^<span class="regexp">/user/</span>([^<span class="regexp">/]*)/</span>news(<span class="regexp">/?)+$ /i</span>ndex.php?subaction=allnews&amp;user=$<span class="number">1</span> last;
rewrite ^<span class="regexp">/user/</span>([^<span class="regexp">/]*)/</span>news/page/([<span class="number">0</span>-<span class="number">9</span>]+)(<span class="regexp">/?)+$ /i</span>ndex.php?subaction=allnews&amp;user=$<span class="number">1</span>&amp;cstart=$<span class="number">2</span> last;
rewrite ^<span class="regexp">/user/</span>([^<span class="regexp">/]*)/</span>news/rss.xml(<span class="regexp">/?)+$ /</span>engine/rss.php?subaction=allnews&amp;user=$<span class="number">1</span> last;
# Output <span class="keyword">for</span> last news
rewrite ^<span class="regexp">/lastnews/</span>(<span class="regexp">/?)+$ /i</span>ndex.php?<span class="keyword">do</span>=lastnews last;
rewrite ^<span class="regexp">/lastnews/</span>page/([<span class="number">0</span>-<span class="number">9</span>]+)(<span class="regexp">/?)+$ /i</span>ndex.php?<span class="keyword">do</span>=lastnews&amp;cstart=$<span class="number">1</span> last;
# Output <span class="keyword">for</span> catalog
rewrite ^<span class="regexp">/catalog/</span>([^<span class="regexp">/]*)/</span>rss.xml$ /engine/rss.php?catalog=$<span class="number">1</span> last;
rewrite ^<span class="regexp">/catalog/</span>([^<span class="regexp">/]*)(/</span>?)+$ /index.php?catalog=$<span class="number">1</span> last;
rewrite ^<span class="regexp">/catalog/</span>([^<span class="regexp">/]*)/</span>page/([<span class="number">0</span>-<span class="number">9</span>]+)(<span class="regexp">/?)+$ /i</span>ndex.php?catalog=$<span class="number">1</span>&amp;cstart=$<span class="number">2</span> last;
# Output <span class="keyword">for</span> <span class="keyword">new</span> posts
rewrite ^<span class="regexp">/newposts(/</span>?)+$ /index.php?subaction=newposts last;
rewrite ^<span class="regexp">/newposts/</span>page/([<span class="number">0</span>-<span class="number">9</span>]+)(<span class="regexp">/?)+$ /i</span>ndex.php?subaction=newposts&amp;cstart=$<span class="number">1</span> last;
# Output <span class="keyword">for</span> favorites news
rewrite ^<span class="regexp">/favorites(/</span>?)+$ /index.php?<span class="keyword">do</span>=favorites last;
rewrite ^<span class="regexp">/favorites/</span>page/([<span class="number">0</span>-<span class="number">9</span>]+)(<span class="regexp">/?)+$ /i</span>ndex.php?<span class="keyword">do</span>=favorites&amp;cstart=$<span class="number">1</span> last;

rewrite ^<span class="regexp">/rules.html$ /i</span>ndex.php?<span class="keyword">do</span>=rules last;
rewrite ^<span class="regexp">/statistics.html$ /i</span>ndex.php?<span class="keyword">do</span>=stats last;
rewrite ^<span class="regexp">/addnews.html$ /i</span>ndex.php?<span class="keyword">do</span>=addnews last;
rewrite ^<span class="regexp">/rss.xml$ /</span>engine/rss.php last;
rewrite ^<span class="regexp">/sitemap.xml$ /</span>uploads/sitemap.xml last;

<span class="keyword">if</span> (!-d $request_filename) {
    rewrite ^<span class="regexp">/([^.]+)/</span>page/([<span class="number">0</span>-<span class="number">9</span>]+)(<span class="regexp">/?)+$ /i</span>ndex.php?<span class="keyword">do</span>=cat&amp;category=$<span class="number">1</span>&amp;cstart=$<span class="number">2</span> last;
    rewrite ^<span class="regexp">/([^.]+)/</span>?$ /index.php?<span class="keyword">do</span>=cat&amp;category=$<span class="number">1</span> last;
}

<span class="keyword">if</span> (!-f $request_filename) {
    rewrite ^<span class="regexp">/([^&lt;]+)/</span>rss.xml$ /engine/rss.php?<span class="keyword">do</span>=cat&amp;category=$<span class="number">1</span> last;
    rewrite ^<span class="regexp">/page,([0-9]+),([^/</span>]+).html$ /index.php?<span class="keyword">do</span>=static&amp;page=$<span class="number">2</span>&amp;news_page=$<span class="number">1</span> last;
    rewrite ^<span class="regexp">/print:([^/</span>]+).html$ /engine/print.php?<span class="keyword">do</span>=static&amp;page=$<span class="number">1</span> last;
}

<span class="keyword">if</span> (!-f $request_filename) {
    rewrite ^<span class="regexp">/([^/</span>]+).html$ /index.php?<span class="keyword">do</span>=static&amp;page=$<span class="number">1</span> last;
}
</code>

请将上述代码存成 .conf 文件 ( linux 系统该文件保存在 /usr/local/nginx/conf ),并在网站设置里面加载

 

除特别注明外,本站所有文章均为站长帮原创,转载请注明出处来自http://www.zzbang.cn/cms/dle/2719.html

关于
站长帮是一个为站长服务的网站

发表评论

表情 格式

暂无评论

登录

忘记密码 ?

您也可以使用第三方帐号快捷登录

切换登录

注册

扫一扫二维码分享