AMH 社区首页
AMH社区 - 开放自由有价值的社区
[综合话题] AMRewrite规则之(一键防盗链) |
|
---|---|
suppore |
suppore 发表于 2017-01-10 20:38:37
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|mp3|zip|rar)$
{ expires 30d; valid_referers *.suppore.cn suppore.cn ; if ($invalid_referer) { rewrite ^/ http://imcm.me/fdl.png; } access_log on; } 要注意的是:调用的盗链图片不能调用本站的。 实例:http://suppore.cn/fdl.png
点赞,加油! (0分)
2017-01-10 20:38:37 1
|
fzpying |
你好,AMRewrite你可以教我下吗?
我的网站是wordpress的Rewrite用的自带的 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; } if ($server_port = 80) { return 301 https://$host$request_uri; } if ($scheme = http) { return 301 https://$server_name$request_uri; } } 后面两条是强制跳转到https的 现在我设置固定链接为 www.xxx.com /archives/%post_id%.html 但是以访问文章还是页面,或者发布的都直接404,教教我好吗?
回复
2017-01-10 20:52:07 2
|
suppore |
网站开启了SSL要先确保使用的WP的后台地址是否已经更改为https://www.xxx.com
回复
2017-01-10 20:54:40 3
|
fzpying |
回复
2017-01-10 20:56:57 4
|
suppore |
回复
2017-01-10 20:57:41 5
|
fzpying |
回复
2017-01-10 20:59:35 6
|
fzpying |
回复
2017-01-10 21:00:14 7
|
suppore |
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; } if ($server_port = 80) { return 301 https://$host$request_uri; } if ($scheme = http) { return 301 https://$server_name$request_uri; }
回复
2017-01-10 21:04:43 8
|
suppore |
正确打开方式:
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; } } if ($server_port = 80) { return 301 https://$host$request_uri; } if ($scheme = http) { return 301 https://$server_name$request_uri; }
回复
2017-01-10 21:06:36 9
|
fzpying |
引用: 我改了 我试试先
回复
2017-01-10 21:10:04 10
|