产品服务AMH 免费服务器主机面板SSL证书 免费SSL证书申请 担保单 免费安全、零费率交易平台编程助手免费智能写代码、翻译AMYSQL 免费MySQL管理工具

AMH 社区首页

 AMH社区 - 开放自由有价值的社区

[求助帖] AMH 301域名重定向配置

nerve
银牌会员
1442.00 价值分

admin 发表于 2013-01-04 00:30:54
引用:
amysql 发表于 2013-9-3 13:33
你规则怎么这样子。
很多重复的$$$肯定错了,
AMRewrite模块上也有一检测功能,可以做检查。

复制代码到论坛发布的时候会自动添加多个$$$,现在好像可以了
location / {
rewrite ^([^\.]*)/topic-(.+)\.html$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$1/portal.php?mod=topic&topic=$$$$$$$$$$$$$$$$2 last;
rewrite ^([^\.]*)/article-([0-9]+)-([0-9]+)\.html$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$1/portal.php?mod=view&aid=$$$$$$$$$$$$$$$$2&page=$$$$$$$$$$$$$$$$3 last;
rewrite ^([^\.]*)/forum-(\w+)-([0-9]+)\.html$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$1/forum.php?mod=forumdisplay&fid=$$$$$$$$$$$$$$$$2&page=$$$$$$$$$$$$$$$$3 last;
rewrite ^([^\.]*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$1/forum.php?mod=viewthread&tid=$$$$$$$$$$$$$$$$2&extra=page%3D$$$$$$$$$$$$$$$$4&page=$$$$$$$$$$$$$$$$3 last;
rewrite ^([^\.]*)/group-([0-9]+)-([0-9]+)\.html$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$1/forum.php?mod=group&fid=$$$$$$$$$$$$$$$$2&page=$$$$$$$$$$$$$$$$3 last;
rewrite ^([^\.]*)/space-(username|uid)-(.+)\.html$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$1/home.php?mod=space&$$$$$$$$$$$$$$$$2=$$$$$$$$$$$$$$$$3 last;
rewrite ^([^\.]*)/([a-z]+)-(.+)\.html$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$1/$$$$$$$$$$$$$$$$2.php?rewrite=$$$$$$$$$$$$$$$$3 last;
#dzcms
rewrite ^([^\.]*)/Vip-(-?\d*).html$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$1/plugin.php?id=dzcms_sj:home&uid=$$$$$$$$$$$$$$$$2 last;
rewrite ^([^\.]*)/News-(-?\d*)-(\d*).html$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$1/plugin.php?id=dzcms_sj:home&u=shown&uid=$$$$$$$$$$$$$$$$2&d=$$$$$$$$$$$$$$$$3 last;
rewrite ^([^\.]*)/Product-(-?\d*)-(\d*).html$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$1/plugin.php?id=dzcms_sj:home&u=showcp&uid=$$$$$$$$$$$$$$$$2&d=$$$$$$$$$$$$$$$$3 last;
rewrite ^([^\.]*)/Hot-(-?\d*)-(\d*).html$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$1/plugin.php?id=dzcms_sj:home&u=showy&uid=$$$$$$$$$$$$$$$$2&d=$$$$$$$$$$$$$$$$3 last;
rewrite ^([^\.]*)/Q-(-?\d*)-(\d*).html$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$1/plugin.php?id=dzcms_sj:home&u=showq&uid=$$$$$$$$$$$$$$$$2&d=$$$$$$$$$$$$$$$$3 last;
rewrite ^([^\.]*)/Print-(-?\d*)-(\d*).html$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$1/plugin.php?id=dzcms_sj:home&u=print&uid=$$$$$$$$$$$$$$$$2&d=$$$$$$$$$$$$$$$$3 last;
rewrite ^([^\.]*)/Home-(.*?)-(-?\d*).html$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$1/plugin.php?id=dzcms_sj:home&u=$$$$$$$$$$$$$$$$2&uid=$$$$$$$$$$$$$$$$3 last;
rewrite ^([^\.]*)/Vip-(.*?).html$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$1/plugin.php?id=dzcms_sj&u=$$$$$$$$$$$$$$$$2 last;
rewrite ^([^\.]*)/Vip.html$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$1/plugin.php?id=dzcms_sj last;
if (!-e $$$$$$$$$$$$$$$$request_filename) {
return 404;
}

#301重定向
if ($$$$$$$$$$$$$$$$http_host ~* "^lq168.com$$$$$$$$$$$$$$$$"){
set $$$$$$$$$$$$$$$$rule_0 1$$$$$$$$$$$$$$$$rule_0;
}
if ($$$$$$$$$$$$$$$$rule_0 = "1"){
rewrite ^/(.*)$$$$$$$$$$$$$$$$ http://www.lq168.com/$$$$$$$$$$$$$$$$1 permanent;
}
if ($$$$$$$$$$$$$$$$http_host ~* "^bbs.lq168.com$$$$$$$$$$$$$$$$"){
set $$$$$$$$$$$$$$$$rule_1 1$$$$$$$$$$$$$$$$rule_1;
}
if ($$$$$$$$$$$$$$$$rule_1 = "1"){
rewrite ^/(.*)$$$$$$$$$$$$$$$$ http://www.lq168.com/$$$$$$$$$$$$$$$$1 permanent;
}
if ($$$$$$$$$$$$$$$$http_host ~* "^news.lq168.com$$$$$$$$$$$$$$$$"){
set $$$$$$$$$$$$$$$$rule_2 1$$$$$$$$$$$$$$$$rule_2;
}
if ($$$$$$$$$$$$$$$$rule_2 = "1"){
rewrite ^/(.*)$$$$$$$$$$$$$$$$ http://www.lq168.com/forum-122-1.html$$$$$$$$$$$$$$$$1 permanent;
}
if ($$$$$$$$$$$$$$$$http_host ~* "^wed.lq168.com$$$$$$$$$$$$$$$$"){
set $$$$$$$$$$$$$$$$rule_3 1$$$$$$$$$$$$$$$$rule_3;
}
if ($$$$$$$$$$$$$$$$rule_3 = "1"){
rewrite ^/(.*)$$$$$$$$$$$$$$$$ http://www.lq168.com/forum-241-1.html$$$$$$$$$$$$$$$$1 permanent;
}
if ($$$$$$$$$$$$$$$$http_host ~* "^rc.lq168.com$$$$$$$$$$$$$$$$"){
set $$$$$$$$$$$$$$$$rule_4 1$$$$$$$$$$$$$$$$rule_4;
}
if ($$$$$$$$$$$$$$$$rule_4 = "1"){
rewrite ^/(.*)$$$$$$$$$$$$$$$$ http://www.lq168.com/$$$$$$$$$$$$$$$$1 permanent;
}
if ($$$$$$$$$$$$$$$$http_host ~* "^w.lq168.com$$$$$$$$$$$$$$$$"){
set $$$$$$$$$$$$$$$$rule_5 1$$$$$$$$$$$$$$$$rule_5;
}
if ($$$$$$$$$$$$$$$$rule_5 = "1"){
rewrite ^/(.*)$$$$$$$$$$$$$$$$ http://www.lq168.com/$$$$$$$$$$$$$$$$1 permanent;
}
if ($$$$$$$$$$$$$$$$http_host ~* "^love.lq168.com$$$$$$$$$$$$$$$$"){
set $$$$$$$$$$$$$$$$rule_6 1$$$$$$$$$$$$$$$$rule_6;
}
if ($$$$$$$$$$$$$$$$rule_6 = "1"){
rewrite ^/(.*)$$$$$$$$$$$$$$$$ http://www.lq168.com/forum-277-1.html$$$$$$$$$$$$$$$$1 permanent;
}
if ($$$$$$$$$$$$$$$$http_host ~* "^3g.lq168.com$$$$$$$$$$$$$$$$"){
set $$$$$$$$$$$$$$$$rule_7 1$$$$$$$$$$$$$$$$rule_7;
}
if ($$$$$$$$$$$$$$$$rule_7 = "1"){
rewrite ^/(.*)$$$$$$$$$$$$$$$$ http://www.lq168.com/$$$$$$$$$$$$$$$$1 permanent;
}
if ($$$$$$$$$$$$$$$$http_host ~* "^hao.lq168.com$$$$$$$$$$$$$$$$"){
set $$$$$$$$$$$$$$$$rule_8 1$$$$$$$$$$$$$$$$rule_8;
}
if ($$$$$$$$$$$$$$$$rule_8 = "1"){
rewrite ^/(.*)$$$$$$$$$$$$$$$$ http://www.lq168.com/$$$$$$$$$$$$$$$$1 permanent;
}
if ($$$$$$$$$$$$$$$$http_host ~* "^job.lq168.com$$$$$$$$$$$$$$$$"){
set $$$$$$$$$$$$$$$$rule_9 1$$$$$$$$$$$$$$$$rule_9;
}
if ($$$$$$$$$$$$$$$$rule_9 = "1"){
rewrite ^/(.*)$$$$$$$$$$$$$$$$ http://www.lq168.com/forum-123-1.html$$$$$$$$$$$$$$$$1 permanent;
}
if ($$$$$$$$$$$$$$$$http_host ~* "^house.lq168.com$$$$$$$$$$$$$$$$"){
set $$$$$$$$$$$$$$$$rule_10 1$$$$$$$$$$$$$$$$rule_10;
}
if ($$$$$$$$$$$$$$$$rule_10 = "1"){
rewrite ^/(.*)$$$$$$$$$$$$$$$$ http://www.lq168.com/forum-296-1.html$$$$$$$$$$$$$$$$1 permanent;
}
}
回复  2013-09-03 17:29:26 11

Shane
银牌会员
1065.10 价值分

刚好今天用到了,我是这样写得(其中的aaa.com指代我的域名):

location / {
if ( $host != 'www.aaa.com' )
{
rewrite ^/(.*)$ http://www.aaa.com/$1 permanent;
}
}

竟然成功了。
  支持 (0分)  反对 (0分)
回复  2014-12-10 22:56:44 12

日拱一卒 功不唐捐

zmsir
铝牌会员
445.00 价值分

引用:
admin 发表于 2013-1-21 00:56
可以在server {}中写if,用$host变量来判断

server {


AMH-5.0 LAMP 环境的怎么写 啊 安装了AMRewrite-1.0这个模块,按照这个方法 写 ,,,,,怎么无法启动 apache了 ,,提示规则错误
  支持 (0分)  反对 (0分)
回复  2014-12-18 23:36:21 13

amysql
创始人
99530.81 价值分

引用:
zmsir 发表于 2014-12-18 23:36
AMH-5.0 LAMP 环境的怎么写 啊 安装了AMRewrite-1.0这个模块,按照这个方法 写 ,,,,,怎么无法 ...

LAMP环境就要使用apache的规则。不能使用nginx的规则。
  支持 (0分)  反对 (0分)
回复  2014-12-19 12:57:09 14

AMH面板 - 好用高效低占用、安全可靠极稳定

zmsir
铝牌会员
445.00 价值分

引用:
amysql 发表于 2014-12-19 12:57
LAMP环境就要使用apache的规则。不能使用nginx的规则。


AMRewrite-1.0 原来是为nginx 写的 啊 我以为通用呢 哈哈 小白了
  支持 (0分)  反对 (0分)
回复  2014-12-21 19:46:35 15
< 1 2  (总2页)
AMH社区列表
用户服务中心