Articles of redirect

Nginx只允许目录结尾,没有index.html或index.php

正在设置一个nginx服务器。 我想添加一些location块,只允许index.html或index.php的父文件夹被提供,但会自己redirectindex.html或index.php 。 我也希望server条目将redirect以斜杠结尾的文件夹为非斜杠版本。 例如: http://www.example.com/about —> good http://www.example.com/about/ —> redirects to http://www.example.com/about http://www.example.com/about/index.html —> redirects to http://www.example.com/about 这里是我有的一个sites-available文件,缩写为MCVE,并删除任何额外的信息。 server { listen 80; root /var/www/html; index index.php index.html index.htm; ssi on; server_name example.com; location ~ /\. { access_log off; log_not_found off; deny all; } location ~ ~$ { access_log off; log_not_found off; deny all; } […]

停止nginx反向代理redirect

有几个类似的问题,但我一直无法弄清楚如何解决我的问题。 我在端口80上运行一个nginx的实例,作为nginx的其他一些实例的反向代理(这是反向代理运行django应用程序的不同实例的gunicorn)。 当我导航到gaiadev1 /,它的作品。 当我login时,发生redirect发送应用程序到gaiadev:8080。 我想停止发生这种redirect,但我不知道如何。 这是80端口的代理服务器的conf: upstream gaiadev1 { server 127.0.0.1:8001; keepalive 32; } upstream gaiatest1 { server 127.0.0.1:9001; keepalive 32; } server { listen 80 default_server; listen [::]:80 default_server ipv6only=on; server_name gaiadev1; location / { proxy_pass http://gaiadev1; } } server { listen 80; listen [::]:80; server_name gaiatest1; location / { proxy_pass http://gaiatest1; } […]

只redirect根目录而不更改Apache中的URL

我只将来到根目录的请求redirect到同一服务器中的子文件夹。 现在我想在redirect期间不改变URL。 我的.htaccess看起来像这样 RewriteEngine on RewriteBase / RewriteCond %{HTTP_HOST} !^m\. RewriteRule ^$ /myFolder [R,L] 我试图添加P作为一个选项,但它没有帮助。 如何做呢?

nginx 302只redirect裸IP

我试图设置一个302redirect,如果有人inputIP地址,但301所有其他请求到该域的www.subdomain。 server { listen 198.251.86.133:80; server_name 198.251.86.133; return 302 http://www.jacobdevans.com/anycast-301/; } server { listen 198.251.86.133:80; server_name _; return 301 http://www.$host$request_uri; } 我有301的工作,除了如果我把上面的302节,我的希望是让任何人(非HTTPS,抱歉)能够指向他们的Alogging根域某处容易做301,example.com到www .example.com的 目前,一切都被第一个听取选项所捕获 # curl -I jacobdevans.com HTTP/1.1 302 Moved Temporarily Server: nginx/1.6.3 Date: Mon, 28 Sep 2015 20:08:45 GMT Content-Type: text/html Content-Length: 160 Connection: keep-alive Location: http://www.jacobdevans.com/anycast-301/ # curl -I 198.251.86.133 HTTP/1.1 302 […]

.htaccess只能redirect到首页?

我的网站有更多的语言,我想这样做redirect每种语言,例如:/ es / to / es,简单的redirect,但这种方法使问题的子页面,我怎么能告诉htaccess使用这个规则只为主页?

Haproxy sslredirect

我不知道,如果我明白如何haproxy完全正常工作。 我有一些系统是由less量服务器组成的,基于http通信。 我想同时使用haproxy作为负载平衡器和类似https服务器的东西。 它应该工作如下:用户写地址和haproxy决定 – 如果它是http然后redirect到https,如果它通过HTTP连接到系统https。 我的意思是只有客户端与haproxy应该有HTTPS连接,但与系统haproxy应该有HTTP。 这里是所描述的架构的图像: 我写了haproxyconfiguration文件,只有我得到的是从httpredirect到https并显示第一个站点 – rest是死的,因为所有通信看起来像: 客户端 – (https) – > haproxy – (https) – >系统 代替 客户端 – (https) – > haproxy – (http) – >系统 是否有可能用haproxy创build它? 以下是我的haproxyconfiguration文件: global pidfile /var/run/haproxy.pid log 127.0.0.1 local2 debug maxconn 2048 tune.ssl.default-dh-param 2048 ca-base /etc/ssl/certs crt-base /etc/ssl/private defaults mode http option forwardfor option […]

将HTTPredirect到使用IIS的HTTPS不适用于SharePoint站点

我有一个Web应用程序。 其AAM如下 – Zone Public URL for Zone Default http://sharepoint:46543 Internet http://abc.something.com Custom https://abc.something.com 在使用IIS Rewrite模块之前,如果我从任何区域访问站点,它都可以正常工作。 但是,一旦我configuration重写模块如下 – 匹配URL部分 Requested URL = Matches the Pattren Using = Regular Expression Pattren = (.*) Conditioins Logical Grouping = Match All Condition Input = {HTTPS} Check if input string = Matches the pattren Pattren = ^OFF$ 操作 Action […]

nginx,redirect删除一部分文件名

我知道有很多问题如何用nginx中的其他东西(或者什么也不是)replaceURL的一部分,但是我确实吸收了正则expression式,并且绝对是nogin in nginx。 所以有人可以解释如何将URL如http://123.123.123.123:9090/v0/A8B9DEBF512F929144257AEE00262C16/$File/IMG_8819.jpg转换为http://123.123.123.123:9090/v0/A8B9DEBF512F929144257AEE00262C16/IMG_8819.jpg (没有$文件/,而不是A8B9DEBF512F929144257AEE00262C16和IMG_8819.jpg可能有数字和字母的任何组合)? 我尝试了这样的事情 location /v0 { rewrite ^(v0/[^/]+)/\$File/(.*)$ $1/$2 last; } 无济于事。 但显然这是正则expression式是错误的,因为至lessnginx认识到它应该做一些/ v0 /和我得到404。

Nginx,将所有resquestredirect到子文件夹中的单个index.php文件

我试图把我的网站从Apache移动到Nginx。 我的网站是这样构build的: www_root 上市 其他文件夹 所有请求都使用.htaccess从www_rootredirect到公用文件夹,其中包含: RewriteRule ^$ public/ [L] RewriteRule (.*) public/$1 [L] 在公共文件夹中 ,所有的请求都被redirect到单个入口点index.php .htaccess: RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?page=$1 [QSA,L] 目前我的服务器块是这样的: server { server_name domain.com www.domain.com; root /var/www/domain.com/htdocs/public; location / { # try to serve file directly, fallback to index.php try_files $uri /index.php$is_args$args; } location ~ ^/index\.php(/|$) { […]

我可以使用Apache中的符号链接进行“静态redirect”吗?

我正在检修网站以使用新的url结构,但不希望旧url为404,而是redirect到新内容。 使事情复杂化,这是在一个共享的主机上.htaccess是唯一允许的configuration。 有很多旧的URL,足以把它们全部插入.htaccess将是一个坏的举动。 我知道RewriteRule指令需要FollowSymLinks ,这意味着我可以在旧URL的位置创build一堆符号链接,指向它们的新位置? 这会让Apache发出redirect到新的位置?