Articles of 301redirect

如何将所有http请求转发到https,而不用使用nginx打开letsencrypt

我使用Nginx作为Rstudio服务器和Shiny服务器的反向代理,用于保护与这些服务的连接。 我正在使用Letencrypt免费签名的证书。 我有这个条目让letsencrypt来validation我是谁我说我是谁。 server { listen 80 default_server; listen [::]:80 default_server ipv6only=on; root /usr/share/nginx/html; index index.html index.htm; # Make site accessible from http://localhost/ server_name mydomain.com; location ~ /.well-known { allow all; } } 我还有另一台server来侦听443和proxy_redirect到我的服务器。 一切工作正常。 我想要做的是类似的东西 server { listen 80; return 301 https://$host$request_uri; } 但我认为这将打破letsencrypt,所以我怎么有以上没有打破letsencryptvalidation?

NginXredirect

对于NginX的新手redirect,而不是我的正则expression式的忍者,有人可以请提供一些点,以便如何做一个理智的方式下面的301redirect。 (为可怕的例子名称道歉) website.com/what -> website.com/en/what website.com/team -> website.com/en/team website.com/stuff -> website.com/en/newstuff website.com/stuff/this -> website.com/en/newstuff/foo/bar website.com/stuff/that -> website.com/en/newstuff/thing/page 虽然我很想有人给我确切的答案 – 我会解决一些好的指针或大致的例子,我需要做的或我应该采取的方向。 如果有帮助,我在Ubuntu 11上运行nginx 0.8x,网站本身是用CodeIgniter编写的,

.htaccess 301redirectURL忽略其参数

文件redirect Redirect 301 /products.php http://domain1.com/product_123.php 和域redirect Redirect 301 / http://www.domain2.com/ 很容易。 但是,我想redirect一些URL,忽略所有参数,即domain1.com/slug1/slug2/slug3?pagination=1 domain1.com/slug1/slug2/slug3?ref=2 domain1.com/slug1/slug2/slug3?day=Monday domain1.com/slug1/slug2/slug3?referer=Google domain1.com/slug1/slug2/slug3?referer=Facebook 等等 应该都redirect到 domain1.com/slug4

.htaccessredirect301循环

我在通过Apache服务器上的.htaccess文件实现301redirect时遇到问题。 我可以在.htaccess文件中启用“redirect301”语句,它们将显示工作几分钟,但在服务器开始返回“太多自动redirect”错误并且网站变得不可用之后不久。 显然,我在代码中有一个循环,但是我看不到它。 有人能够指出吗? 另外,我应该使用“RedirectMatch”而不是“redirect”? 这里是.htaccess文件的内容: ErrorDocument 404 http://www.example.com/404.html RewriteEngine On RewriteRule (wooden_house|straw_house|brick_house_(One|Two|Three)Piggy)\.html$ /$1.php # //Rewrite to www Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} ^example.com [nc] RewriteRule ^(.*)$ http://www.example.com/$1 [r=301,nc] RewriteCond %{ENV:REDIRECT_STATUS} 200 RewriteRule .* – [L] # //301 Redirect Old File Redirect 301 /index.php http://www.example.com Redirect 301 /index.shtml http://www.example.com Redirect 301 /index.pl http://www.example.com Redirect […]

Nginx如何强制浏览器禁用或刷新redirectcaching?

我们有以下安全网站。 如果用户打开http://name.tld ,他应该被redirect到https://name.tld 。 我们最初搞砸了安全站点域的顺序,所以http://name.tld被redirect到了https://sub.name.tld而不是http://name.tld 。 我们改变了服务器名称的顺序,但是所有的浏览器都caching了redirect。 如果我手动禁用caching的铬,它的作品。 但其他任何人都需要这样做。 我们如何强制所有的浏览器清除他们的redirectcaching(首选)或禁用告诉他们不cachingredirect? 有我们可以发送的标题吗? 这是我们的网站: server { listen 80; server_name name.tld sub.name.tld localhost sub.localhost; return 301 https://$server_name$request_uri; } server { listen 443 ssl; server_name name.tld sub.name.tld localhost sub.localhost; ssl_certificate /etc/ssl/certs/fullchain.pem; ssl_certificate_key /etc/ssl/private/privkey.pem; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers HIGH:!aNULL:!MD5; # required for large JSON files client_max_body_size 50m; #charset koi8-r; […]

.htaccess 301redirectPLUS URL重写

前提: 我的摄影网站是www.domain.com,我的博客是在www.domain.com/blog上。 一切都在自我托pipe的WordPress平台上。 在我的索引页上,我有我的照片画廊。 我现在想用第三方服务在www.galleries.com/me上主持我的画廊。 我想实现的是: 当有人访问www.domain.com它被301redirect到www.galleries.com/me,但保持我的域在URL地址中可见 当有人访问www.domain.com/blog时,一切照常进行,没有任何变化。 我以为: 美国redirect规则加上我的.htaccess的重写规则 问题: 可能吗? 我该怎么做? 它如何影响search引擎优化? 我试图让它尽可能简单:)谢谢

Nginx的HTML内容,而redirect

当在nginx中configurationredirect时,响应包含: <html>[CRLF] <head><title>301 Moved Permanently</title></head>[CRLF] <body bgcolor="white">[CRLF] <center><h1>301 Moved Permanently</h1></center>[CRLF] <hr><center>nginx</center>[CRLF] </body>[CRLF] </html>[CRLF] 在debugging时: curl -i http://www.domain.com 我可以隐藏redirecthtml的关于nginx的信息吗? 我通过设置more_set_headers "Server: ";pipe理关于nginx的隐藏信息more_set_headers "Server: ";

NGINX:301重写

我有一个在Nginx中设置的301重写列表。 我想指定完整的uri而不是使用正则expression式。 写这种方式是什么? 这是我认为应该做的事情: rewrite /o-atipico /rogerio-madureira.htm permanent; rewrite /CHANGELOG.txt / permanent; rewrite /MaxLucado / permanent; rewrite /adwords / permanent; rewrite /animals.txt / permanent; rewrite /apresentacao / permanent; rewrite /arquivos / permanent; rewrite /atipico / permanent; rewrite /atipico.com.br / permanent; rewrite /baix / permanent; rewrite /baixe.asp / permanent; rewrite /blog / permanent; rewrite /c / […]

nginx https 443从无子域redirect到“www”子域

我的configuration: server { listen 80; server_name mydomain.com; rewrite ^(.*)$ $scheme://www.mydomain.com$1; } server { listen 80; server_name www.mydomain.com; return 301 https://www.mydomain.com$request_uri; if ($host !~* ^(www.mydomain.com)$ ) { return 444; } } server { listen 443; server_name www.mydomain.com; ssl on; ssl_certificate /path/to/www.mydomain.com_chain.pem; ssl_certificate_key /path/to/www.mydomain.com.key; … } 什么工作 : 从mydomain.comredirect到www.mydomain.com 从www.mydomain.comredirect到https://www.mydomain.com 什么不能正常工作 : 当我直接进入https://mydomain.com进入浏览器时,redirect到www.mydomain.com根本不会发生,但是请求被传递到应用程序服务器上https://mydomain.com 它看起来好像端口80“入口”正在跳过,服务器正在直接访问端口443,但我不是一个Nginx的专家,所以我不能告诉 什么是上面的https://mydomain.com问题的解决scheme?

Haproxy 301 URL在查询string条件下redirect

使用在Ubuntu 12.04上运行的Haproxy 1.5.12 我的网站得到很多像这样的请求: http://www.example.com/foo/bar/mypage.php?gallery=&position=3 正确的URL应该是: http://www.example.com/foo/bar/mypage.php?gallery=photogallery&position=3 我已经成功地将请求重写到正确的URL,但我也想发出301redirect到客户端。 以下这篇文章: 使用haproxyredirect重写的URL我试过: acl fix_gallery url_sub gallery=& reqrep (.*)gallery=&(.*) \1gallery=photogallery&\2 redirect prefix / code 301 if fix_gallery 试图有创意我试过了: acl fix_gallery url_reg (.*)gallery=&(.*) acl fix_gallery urlp_reg(gallery) -m str "" acl fix_gallery urlp_reg(gallery) -m len 0 还有很多。 但似乎没有任何工作,所以我显然失去了一些东西。 有什么build议么? 谢谢