Nginx v 1.4.6 autoindexclosures; 在没有中心路由端点的应用程序中,对于没有索引*的结构中的目录,我想要外部redirect,而不是403 Forbidden或内部redirect。 app-root/ app-core/ config/ lib/ modules/ templates/ index.php 鉴于上述情况,如果没有任何app-core / lib / modules / templates /具有索引*,且没有server { location {}}configuration覆盖,则对它们的任何请求都会导致402禁止响应。 令人讨厌。 有了这个configuration,我可以在内部redirect到一个实际的索引。 location ~* ^/(app-core|config|lib|modules|templates)/$ { index /; } 因此,对http://localhost:xxxx/lib/的请求将服务于上面显示的app-root / index.php。 够公平的,但我认为这可能会更好。 我宁愿发出一个303 见其他和redirect到http://localhost:xxxx/但我不知道如何使其工作。
我有一个nginx服务器和一个域example.com。 每个客户都有他自己的子域名,比如wsb.example.com等。他们的内容通过PHP更改,但所有子域名都被redirect到Web服务器上的相同文件夹。 我遇到的唯一问题是访问没有HTTPS的域名。 https://whatever.example.com/正常工作,但whatever.example.com会将我redirect到https://*.example.com/ 我究竟做错了什么? server { listen *:80; listen *:443 ssl; server_name *.alterament.de; index index.php; root /var/www/webapp.alterament.de/public; ssl_certificate ssl/alterament.de.crt; ssl_certificate_key ssl/alterament.de.key; if ($ssl_protocol = "") { rewrite ^/(.*) https://$server_name/$1 permanent; } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location /resources { root /var/www/webapp.alterament.de; } }
我们目前有一个通配符虚拟主机接受所有的域名请求。 我想redirectsubdomain.domain.com到www.subdomain.domain.com所以我的通配符将回答 有一个例外,我不想将www.domain.comredirect到www.www.domain.com 如何实现? 我放在一起(在通配符块之外),但它不处理exception,并不确定variables的事情 if ($http_host ~ (.*).domain.com) { set $test P; } if ($http_host != www.domain.com) { set $test "${test}C"; } if ($http_host != www.*.domain.com) { set $test "${test}D"; } if ($test = PCD) { rewrite ^(.*)$ www.%1.domain.com$1 permanent; } 谢谢
我有一个域名,所以www.mysite.com运行应用程序Django。 在这个服务器上,我创build了一个WordPress的博客。 www.mysite.com/blog Nginx的Django应用程序: upstream django { server 127.0.0.1:8001; } server { listen 80; location /blog { proxy_pass http://127.0.0.1:8000; } } Nginx的WordPress的: server { listen: 8000; root /var/www/html/blog; index index.php; location / { try_files $uri $uri/ /index.php?$args; } [……] } 如果我inputwww.mysite.com/blog显示我的第404页。如果我键入www.mysite.com:8000显示我的索引WordPress。 我如何删除端口“:8000”的url,因此离开wwww.mysite.com/blog,并显示我的索引WordPress?
我想为我的nginx服务器块中的特定查询创build一个永久redirect。 举例来说,我的当前链接到PHP脚本的URL已经: website.com/?hash=12345 所以我需要将其更改为website.com/folder/?hash=12345有没有一种方法来redirect永久只有当参数?哈希=在查询中给出并离开所有其他查询如何? 编辑:我在这里做了一些testing location ~* /.*hash\=.*/ { rewrite ^ https://mysite.eu/bluetracker/$request_uri? permanent; } 但可悲的是,这也是行不通的
我尝试在https://上redirecthttp:// www &http://,但我有一个redirect循环,你知道为什么吗? 当我只把server_name www.mywebsite.lol可以httpsredirect… 我试过了 server { server_name mywebsite.lol; rewrite ^(.*) https://mywebsite.lol$1 permanent; } 和 server { server_name mywebsite.lol; return 301 https://$server_name$request_uri; } 而我的完整:configuration server { # Port listen 80; # Hostname server_name mywebsite.lol; # Logs (acces et erreurs) access_log /var/log/nginx/mywebsite.lol.access.log; error_log /var/log/nginx/mywebsite.lol.error.log; # Repertoire root /home/mywebsite/www; # Fichier a executer par defaut (en […]
我使用Apache 2.2.3(旧版本,我知道) 所以我试图redirect基于旧版本的IE(6和7现在…),我得到一个redirect循环。 我有: RewriteEngine On RewriteCond %{HTTP_USER_AGENT} "MSIE\ [6-7]" [NC] RewriteRule .* https://example.com/upgrade.html [R=302,L] 在虚拟机中使用类似IE7的东西只需要花费很长时间,根本不会加载。 也尝试了这个与browserstack,具有相同的结果。 通常我的网站会出现,但是这个重写对我来说工作不太好。 我想redirect到一个页面,如果Apache看到IE6,7而不是去主页。 使用JavaScript库为此不适用于我,因为一切都是dynamic生成的。
我需要使用nginx将整个目录的内容redirect到另一个目录。 虽然我的configuration工作,但不幸的是也暴露了端口号。 这是我现在猜测一个副作用,因为特定域的入站stream量通过HAProxy ACL规则处理到8000端口,而URL本身是端口80。 这是我的nginx conf: server { listen 8000; port_in_redirect off; location ~* ^/data/dir1/(.*)$ { return 301 /data/dir2/$1; } … 它从URLredirect: domain.com/data/dir1 / … 至: domain.com:8000/data/dir2 / … 我怎么能摆脱URLredirect内的8000? 我有的tmp解决方法是把80redirect,但我担心,这将影响谷歌列出的url,因为它包括一个端口号。
我在OpenShift Online [PAAS]帐户上安装了一个Wordpress网站。 如果我将http:// example.com中的 WordPress地址和站点地址 (在常规设置中)都configuration为http:// example.com (没有空格;我在这里添加了空间以防止使用http链接发布),然后请求该URL返回“太多redirect“错误(我认为这是一个310错误)。 www.example.com也一样 如果我将它们configuration为http:// www.example.com (再次没有空间),请使用www。 ,然后所有的WordPress的页面加载 … 他们加载的example.com和www.example.com请求 为什么会发生,并迫使我做2。 从大量的在线资源,它看起来像1应该工作? 相关资料: 我的Wordpress安装时的默认url是app-user.rhcloud.com (这是我更新到我的自定义域之前,Wordpress地址和网站地址的默认值)。 在更新这些URL之前,请求加载所有页面 随着更新Wordpress地址和网站地址,我相应地在www.example.com – > app-user.rhcloud.com OpenShift应用程序添加一个别名。 (没有什么不同,如果我也别名example.com – > app-user.rhclud.com) 我有example.com注册的example.com。 他们将来自example.com的请求redirect到www.example.com 我有一个CNAMElogging,将www.example.com映射到我的OpenShift的app-user.rhcloud.com(OpenShift指示自定义域名) 我会认为1应该已经被4 – 6充分地促进了。 谢谢!
我有一个网站,其名称从example.com更改为newexample.com。 我的思考过程(请评论这一点,以及我的方法可能是不正确的)是configuration永久redirect从http:(s):// .example.com / (我不使用字面正则expression意义这里) https://www.newexample.com/ 。 在重写规则部分,我采取了以下的方法: <rewrite> <rules> <rule name="Redirect to newexample.com"> <match url=".*" /> <conditions logicalGrouping="MatchAny"> <add input="{HTTP_HOST}" pattern=".*" negate="true" /> </conditions> <action type="Redirect" url="https://www.newexample.com/{R:0}" redirectType="Permanent"/> </rule> </rules> </rewrite> 我了解上述规则的方式是,任何主机名将被redirect到“ https://www.newexample.com/whatever ”,离开所请求的url的所有其他方面,但我没有得到redirect使用任何我到目前为止尝试的组合。