Articles of 重写

IISredirect到www

我正在使用IIS 7来托pipe一个Web应用程序。 目前,我在web.config中有一条规则,将所有stream量redirect到HTTPS,但是它不会自动将stream量redirect到www,这对于某些function很重要。 web.config显示如下: <rewrite> <rules> <rule name="HTTP to HTTPS redirect" stopProcessing="true"> <match url="(.*)" /> <conditions> <add input="{HTTPS}" pattern="off" ignoreCase="true" /> <add input="{URL}" pattern="seek\.svc$" ignoreCase="true" negate="true" /> </conditions> <action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" /> </rule> </rules> </rewrite> 任何人都可以告诉我如何将所有请求redirect到www? 使用此路线或使用IIS GUI。 我已经find了这个: IIS 6 – build立301redirect非www到wwwsearch引擎优化 哪个技巧,但创build一个重复的网站似乎有点混乱给我。 还有其他build议吗? 谢谢

不能得到RewriteCond规则工作在mod_rewrite

我有以下path: http://www.domain.com/cgi-bin/hsrun.exe/Distributed/Postphil/postphil.htx;start=DetectLanguage?Language=LANG_Icelandic 如果path包含文件夹/ p​​ostphil我想redirect到一个新的域 但是我还没有能够使RewriteCond规则起作用 RewriteCond %{REQUEST_URI} ^postphil+ [NC] RewriteRule ^(.*)$ https://www.newdomain.com/ [R=301,L] 我一直在使用rewrite-rule-tester的在线testing人员来尝试找出有效的东西,但没有运气。 任何想法如何写RewriteCond条件?

将urlredirect到新的主机

我有以下url显示一个正常的静态网站: www.example.com 。 这个网站在亚马逊热。 我想让所有以www.example.com/redirect开头的urlredirect到我拥有的另一个主机帐户。 请注意,我也希望主机在上述域(即,这不是重新指向另一个url)。 如果这个账户位于1.23.345.678 。 为了做到这一点,我需要在.htaccess文件中改变什么?

301redirect(mod重写)一个完整的文件夹和所有具有get参数的文件

我希望将所有url(从www.site.com/online/开始)redirect到www.site.com 我试图redirect的文件的一些例子是… www.site.com/online/folder1/folder2/folder3/?gdt=wbgMfFt9PVUKEwjiparBqM-kAhUMdoYKHW5GKa0QAhgBIAQw-PuCATgeUPj7ggFQpPmYD1CGra8PUIvr_xNQuOv_E1DU6IQbUIq23B5QsuXZIFD5uqqnAVCDrYrIAVCgy5HZAQ&slt=8&slr=5&lpt=2 我目前的情况是非常简单的,它除了在URL中删除参数以外, RewriteRule ^online/(.*) http://www.site.com [R=301,L] 现在这个规则将redirect www.site.com/online/folder1/folder2/folder3/?randomgetparameter=blablabla 至 www.site.com/?randomgetparameter=blablabla 而不是redirect到 www.site.com

图像和AJAX不加载与mod_proxy_html打开

目前,我们公司正在支持一个使用内置Web服务器(由名为Web Server 4D的扩展提供)在第四维(2003)中编写的(非常古老的)启用Web的数据库应用程序。 由于Web服务器没有SSL支持,我们的客户端设置Apache来处理外部HTTPS连接(通过<VirtualHost> ),并使用mod_proxy通过HTTP将所有stream量路由到WS4D服务器。 路由工作正常。 问题在于WS4D服务器在构build页面时经常打印出破损的URL。 由于WS4D服务器不知道Apache,只要打印出一个完整的URL(包含域),就会在URL中打印出一个内部域名和端口号,而不是外部URL(例如http:// localhost:9999 /在家而不是https://www.example.com/home )。 大多数其他链接是相对的(如/img/smiley.png),因此工作正常。 为了解决这个问题,我们尝试设置一个名为mod_proxy_html的第三方Apache模块,用正确的域重写链接。 然而,只要我们在httpd.conf中激活模块( ProxyHTMLEnable On ,但没有定义重写规则),突然之间,我们的PNG和AJAX请求(之前工作的)都无法加载! 我不确定,但我认为服务器可能会返回这些与错误的MIMEtypes。 有谁知道我们如何解决/debugging这个问题? 更新:我检查了PNG的链接,因为它们是相对链接(例如/img/smiley.png),所以它们正在打印出来。 然而,当我把URL放到浏览器中的时候,我得到了一堆乱码(我认为这是一个格式化为文本的二进制图像)。 奇怪的是,最开始有三个HTML标签: <html><body><p> 。 更新2:标记绝对不是由我的浏览器(Safari)添加。 当我closuresmod_proxy_html ,图像正常载入页面,但直接访问URL时仍然以文本方式打开。 closuresmod_proxy_html后,图像源中的<html><body><p>标记消失。

URL重写模块从IIS7.5到Tomcat 6.0

我们有一个Java应用程序将被安装到tomcat6。 我们的安全团队不会允许Tomcat公开对待,所以我需要接收httpsstream量到IIS 7.5,并使用URL重写将stream量引导到Tomcat6(使用URL重写模块2)。 IIS 7.5和Tomcat6都在同一台服务器上。 我的问题如下: 我可以redirecthttpsstream量从IIS7.5到Tomcat6? 如果是的话如何保持encryption? (我已经在外部networking路由器和IIS7.5站点之间安装了SSL) 我是否正确地说,从IIS7.5到Tomcat接收到的stream量不会被返回到IIS7.5,并且它将被发送回客户端地址,并且需要通过https连接到连接到公众的networking设备? 根据没有。 3,当Java应用程序响应httpsstream量,我相信它会直接回应客户端,这将是外部networking设备 – 我如何设置tomcat和networking设备之间的SSL,因为我相信这将是一个新的连接? ?? 任何帮助将不胜感激 干杯杰夫

nginx将一堆子域重写为域

我configuration了我的第一个nginx服务器,我必须redirectsubdomain1.domain.com,subdomain2.domain.com和一些更多的domain.com 我在nginx中search了很多关于重写的内容,但找不到任何有用的东西。 谢谢!

HAProxy – 根据条件执行多个重写

我试图根据一些条件重写一个URI以及主机头。 这是我想要完成的一个例子: 我请求http://sub1.example.com/test/files/other if hdr_beg(Host) sub1.example.com and path_beg /test rewrite host header to sub2.example.com rewrite URI to /files/other (in other words, remove test from the URI) 最终的结果应该指向sub2.example.com/files/other而用户不知道。 我已经尝试了以下configuration: acl host_beg_sub1 hdr_beg(Host) sub1.example.com acl path_beg_test path_beg /test rewrite host header if host_beg_sub1 path_beg_test rewrite URI if host_beg_sub1 path_beg_test 显然,这不能按预期工作,因为第二次重写不会在主机头被修改之后触发。 因为有其他stream量的URI可能以testing开始,所以我不能无条件重写。 提前致谢!

IIS7中的虚拟目录上的反向代理

我正在运行一个WHS 2011并尝试通过IIS7代理一个内部networking服务器(亚音速)。 目标是: https:// external_host / subsonic – > http:// internal_host:4040 到目前为止我所做的是: 在默认网站中创build一个虚拟目录“亚音速” 项目清单 创build了重写规则 无论何时我调用urlhttps:// external_host / subsonic,当尝试访问https://external_host/login.view时,我会得到一个404。 login.view实际上是内部Web服务器的login页面。 这是虚拟目录“subsonic”上的configuration: <rewrite> <rules> <rule name="ReverseProxyInboundRule1" stopProcessing="true"> <match url="(.*)" /> <action type="Rewrite" url="http://homeserver:4040/{R:1}" /> </rule> </rules> <outboundRules> <rule name="ReverseProxyOutboundRule1" preCondition="ResponseIsHtml1"> <match filterByTags="A, Form, Img" pattern="^http(s)?://homeserver:4040/(.*)" /> <action type="Rewrite" value="http{R:1}://www.external.com/{R:2}" /> </rule> </outboundRules> </rewrite> 是否有可能在虚拟目录上运行反向代理?

nginx重写为/blah/(.*)/ $ 1

我正在从mod_php迁移到nginx。 我得到了一切工作,除了这个重写..我只是不熟悉的nginxconfiguration知道正确的方法来做到这一点。 通过在nginx网站上查看示例,我想到了这一点。 server { server_name test01.www.myhost.com; root /home/vhosts/my_home/blah; access_log /var/log/nginx/blah.access.log; error_log /var/log/nginx/blah.error.log; index index.php; location / { try_files $uri $uri/ @rewrites; } location @rewrites { rewrite ^ /index.php last; rewrite ^/ht/userGreeting.php /js/iFrame/index.php last; rewrite ^/ht/(.*)$ /$1 last; rewrite ^/userGreeting.php$ /js/iFrame/index.php last; rewrite ^/a$ /adminLogin.php last; rewrite ^/boom\/(.*)$ /boom/index.php?q=$1 last; rewrite ^favicon.ico$ favico_ry.ico last; } […]