Articles of 重写

IIS用可选的查询string重写或添加默认值

我正在使用IIS 8,只是学习重写,因为我从来没有写任何关心SEO的东西。 我有以下规则,假设url如下所示: /survey/abc123/email <rule name="Survey Rule" stopProcessing="true"> <match url="survey/([_0-9a-z-]+)/([_0-9a-z-]+)" /> <action type="Rewrite" url="survey.htm?var1={R:1}&amp;var2={R:2}" /> </rule> 在survey.htm页面上,我有检查var1&var2的存在的代码,但是在这个重写中,如果我有url /survey/abc123那么它并不会显着地触及调查规则。 我已经尝试了几个<conditions>但可以find正确的。 我觉得一定有办法说 If {R:1} exists then var1={R:1} else var1='' If {R:2} exists then var2={R:2} else var1='' 理想情况下,一些types如果循环 在重写过程中有没有办法做到这一点,不pipe调查后有多less/有没有0或10它总是它的调查页?

php-fpm不能用于nginx重写

我试图重写到一个PHP文件在Nginx中没有改变的URL,但PHP-FPM没有处理文件,我得到的是一个500。 如果我删除重写并直接访问文件,它的工作原理,所以.php文件没有错。 server { listen 80; root /var/www/example.com/public_html; server_name example.com www.example.com; index index.html index.php; add_header Access-Control-Allow-Origin *; location ~ ^/InfoCenter/api/.*$ { rewrite "/InfoCenter/api/(.*)" /InfoCenter/api/index.php last; } location / { try_files $uri $uri/ =404; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/run/php/php7.0-fpm.sock; include fastcgi_params; } location ~/\.htaccess { deny all; } }

redirect/重写域的一部分到不同的域

我有一个问题,我一直试图解决使用URL重写,但我不能让它按我想要的方式行事。 我有一些奇怪的情况。 我很抱歉,这个问题没有很好的格式,因为我必须迅速解决这个问题。 我有两个服务器在不同的位置。 两者都运行IIS。 一台服务器有一个默认网站,下面有许多networking应用程序。 他们正在使用 domain.com/Site1 domain.com/Site2 domain.com/Site3 另一台服务器有 new.domain.com/Site1 new.domain.com/Site3 我需要一个请求domain.com/Site1自动redirect到new.domain.com/Site1 – 但是,我不能让domain.com/Site2redirect到任何东西,它必须是在该特定的子应用程序的规则。 最重要的是,任何请求,如domain.com/Site1/Really/Long/Path….应该redirect到new.domain.com/Site1/Really/Long/Path…. 我尝试了很多东西,这是我最近的尝试。 它似乎没有做任何事情,所以显然我没有得到什么: <rewrite> <rules> <rule name="Datacenter Redirect" patternSyntax="Wildcard"> <match url="*domain.com*" /> <action type="Redirect" url="new.domain.com/{R:0}" /> </rule> </rules> </rewrite> 任何人都可以请指出我在正确的方向吗? 我对IIS很熟悉,但不能重写。 domain.com是IIS 7.5

当使用url_rewrite_program时,squid在查询中添加LAN IP,squid用户名和squid端口

我使用squid作为SSL Bump截取的透明代理。 Squid的HTTP和HTTPS端口configuration是: http_port 3127 transparent https_port 3129 intercept ssl-bump generate-host-certificates=on cert=/opt/squid/ssl_cert/cert.crt key=/opt/squid/ssl_cert/cert.key options=NO_SSLv2,NO_SSLv3 我写了下面的URL程序来强制安全searchGoogle和duckduckgo: #!/usr/bin/perl use strict; use URI::URL; # Turn off buffering to STDOUT $| = 1; # Read from STDIN while (<STDIN>) { # Do some trimming s/^\s*//; s/\s*$//; my $string = $_; # Google Safe search if ($string =~ m/^http(s?)\:\/\/([az]+\.)?google\.([az]{2,3})(\.[az]{2,3})?\/.*(\?(as_)?q=)|(\#(as_)?q=)|(\&(as_)?q=)/) { […]

如何在Nginx重写中如何转义哈希符号“#”字符?

我正在尝试在nginx中为以下url添加重写规则http://www.example.com/gallery/how-make-your-own-cider#step-4-juice-and-strain,但没有任何反应,我怀疑它是因为散列符号。 请问我该如何转义nginx重写中的散列符号字符。 rewrite ^/gallery/how-make-your-own-cider#step-4-juice-and-strain http://www.example.com/article/recipe-how-make-your-own-cider permanent;

Nginx重写子页面为主页面(laravel)

我在我的网站上有一个页面: http : //example.com/sub-page 我想要访问时看到该页面: http : //example.com/ 该网站是一个dynamic的PHP页面(laravel站点),需要在nginx中configuration如下: location / { try_files $uri $uri/ /index.php$is_args$args; } 我最后尝试使用rewrite ^/$ /sub-page last; 在上面的位置块,但它不按预期工作。 我怎样才能做到这一点?

nginx重写proxy_passconfiguration不工作

我有一个configurationnginx服务器; server { listen 9090; server_name localhost; root /Users/anonuser/Desktop/workspace/ttttt/portal/design; 其中有一套rewrite和proxy_pass命令; rewrite ^.*(/account/.*)$ $1 last; location /account { proxy_pass https://www.example.com; } rewrite ^.*(/iap-dataapi/.*)$ $1 last; location /iap-dataapi { proxy_pass https://www.example.com; } rewrite ^.*(/era/.*)$ $1 last; location /era/ { proxy_pass https://www.example.com; } rewrite ^.*(/imageScaler/.*)$ $1 last; location /imageScaler/ { proxy_pass https://www.example.com; } 我打电话给位于的应用程序; http://localhost:9090/oba-client/com/tttt/portal/cust/ 有一个index.html文件位于,它有一个线,以一个类似的东西给一个主机的Ajax请求; HTTP://本地主机:9090 / […]

IIS URL重写添加端口号

我有一个相当基本的IIS重写规则configuration为采取任何非HTTPS请求,并将其redirect到HTTPS版本: <rule name="Redirect to HTTPS" stopProcessing="true"> <match url="(.*)" /> <conditions> <add input="{HTTPS}" pattern="^OFF$" /> </conditions> <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" /> </rule> 出于某种原因,如果有人访问http://example.com (例如没有www ),它会将它们redirect到https://www.example.com:80 (端口号显示在浏览器中),这会导致协议不匹配你不能在80上使用HTTPS。这个规则已经生效了很多年,我确信我从这里得到了这个规则: https : //www.sslshopper.com/iis7-redirect-http-to-https。 HTML 。 任何build议,为什么这会导致端口号出现,并成为不正确的? 对我来说完全是无稽之谈。 谢谢!

IIS多个维护页面用于不同的URL

我们有一个带有一个IIS网站的Web服务器和4个使用URL重写指向同一个IIS网站的URL。 是否有可能为每个URL分开维护页面。

iis url重写用户友好的url多个规则冲突而不起作用

我一直在试图创build用户友好的url,但多条规则似乎有冲突。 我需要像这样创build它: www.example.com/destination/abc www.example.com/river/cde 有了这个代码: <rules> <rule name="RedirectUserFriendlyURL3" stopProcessing="true"> <match url="^destination\.php$" /> <conditions> <add input="{REQUEST_METHOD}" pattern="^POST$" negate="true" /> <add input="{QUERY_STRING}" pattern="^([^=&amp;]+)=([^=&amp;]+)$" /> </conditions> <action type="Redirect" url="{C:1}/{C:2}" appendQueryString="false" /> </rule> <rule name="RewriteUserFriendlyURL3" stopProcessing="true"> <match url="^([^/]+)/([^/]+)/?$" /> <conditions> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> </conditions> <action type="Rewrite" url="destination.php?{R:1}={R:2}" /> </rule> <rule name="RedirectUserFriendlyURL4" stopProcessing="true"> […]