我在我的Web.config中定义了以下规则: <rule name="Enforce canonical hostname" stopProcessing="true"> <match url="(.*)" /> <conditions> <add input="{HTTP_HOST}" negate="true" pattern="^www\.mydomain\.org$" /> </conditions> <action type="Redirect" url="http://www.mydomain.com/" redirectType="Permanent" /> </rule> 我所经历的奇怪的是… 看来我被redirect到https://www.mydomain.com/ ,这导致我的浏览器挂起。 我没有打开SSLencryption,也没有任何特殊的授权规则。 有问题的Web服务器位于F5负载均衡器的后面。 有任何想法吗?
我正在尝试重写我的url的子域名。 http:// username .domain.com将显示http://www.domain.com/user.php?u= 用户名的内容,但URL保留为http:// username .domain.com。 (我的意思是url掩盖 ) (用户名可以包含az 0-9和超级) 同样,如果subdomain是www或api ,不要redirect它们 我用我的.htaccess RewriteEngine on RewriteCond %{REQUEST_URI} !^/index\.php$ RewriteCond %{HTTP_HOST} !^www\.domain\.com RewriteCond %{HTTP_HOST} ^([^.]+)\.domain\.com RewriteRule .* /user.php?u=%1 [L] (在@ mfarver的build议之后)我正在尝试这个 RewriteEngine on RewriteRule .* /user.php?u=%1 [L] 但是这次得到500内部服务器错误: [Mon May 30 20:10:44 2011] [alert] [client 81.6.xx.xxx] /home/blablabla/public_html/.htaccess: AllowOverride not allowed here (来自错误日志) 我的服务器的httpd.conf文件的虚拟主机设置 <VirtualHost 109.73.70.169:80> […]
如果你把它放在你的.htaccess文件中 Options MultiViews 你有这些文件 stuff/ howto.html index.php items.php 那么所有这些url都可以工作 /stuff/ # brings up /stuff/index.php. # Yes, this would have worked `# even without MultiViews /stuff/howto # brings up /stuff/howto.html. #`This would not have # worked without MultiViews, # although you could have done # it with a Rewrite rule, too /stuff/items # brings up /stuff/items.php […]
我试图得到一个简单的万维网。 到非www。 redirect设置。 这是.htaccess DirectoryIndex index.php RewriteEngine On RewriteCond %{HTTP_HOST} ^www.domain.org [NC] RewriteRule ^(.*)$ http://domain.org/$1 [L,R=301] RewriteBase / ########## Begin – Rewrite rules to block out some common exploits ## If you experience problems on your site block out the operations listed below ## This attempts to block the most common type of exploit `attempts` […]
我试图编写一个自定义的redirect规则为2testing目的完全相同的网站。 我使用的代码是: RewriteEngine on RewriteCond %{REMOTE_ADDR} !^1\.2\.3\.4$ RewriteCond %{HTTP_HOST} ^.*site1.com [NC] RewriteRule ^(.*)$ http://www.site2.com/$1 [R=301,L] 我想要的是将所有请求的site1redirect到site2,除了来自IP地址1.2.3.4的请求。 但目前来自该IP的请求也正被redirect到site2。 有什么我错过了设置? (注意:两个域名都在同一个共享主机帐户上) 编辑:我也尝试过: RewriteEngine on RewriteCond %{REMOTE_ADDR} !^my_ip$ [OR] RewriteCond %{REMOTE_ADDR} !^server_ip$ RewriteCond %{HTTP_HOST} ^.*site1 [NC] RewriteRule ^(.*)$ http://site2/$1 [R=301,L] RewriteEngine on RewriteCond %{REMOTE_ADDR} !=my_ip [OR] RewriteCond %{REMOTE_ADDR} !=server_ip RewriteCond %{HTTP_HOST} ^.*site1 [NC] RewriteRule ^(.*)$ http://site2/$1 [R=301,L] RewriteEngine […]
这是我正在处理的遗留代码,我不能改变它发布到哪里,所以我只需要找出一个方法。 一点的Javascript做一个职位如下 – POST /authentication/login/ 这是非常奇怪的,因为它张贴到一个目录,但无论如何,我想configurationNginx接受到这个位置的post,然后将它们传递给我的Nginxconfiguration中的一点PHP我有以下内部一个http块 server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { root html; index index.html index.htm; } location /authentication/login/ { index hello.php; #root html; #index /usr/local/nginx/html/hello.php; } location ~.php$ { include /usr/local/nginx/conf/fastcgi_params; fastcgi_pass 127.0.0.1:9000; } } PHP的东西的作品,我可以直接进入hello.php和那个作品。 我的错误日志/访问日志并不真的给我很多。 我在hello.php上得到了一个404,但是通过放入“index”来解决这个问题。但是,这永远不会导致PHP的调用。 我也尝试把fastcgi的东西放入nginx.conf中的/ authenticate / login / location。 关键在于,如果我发布一些/ […]
我有一个像这样的文件夹结构的nginx设置: – www |- splash |- blog www是根文件夹。 我想将访问http://example.com用户redirect到splash文件夹。 但我不希望地址栏中的url更改为http://example.com/splash 。 地址栏中的url仍应为http://example.com 。 此规则只适用于用户访问根文件夹。 同时访问blog文件夹将像往常一样通过: http://example.com/blog : http://example.com/blog 。 我如何做到这一点? 到目前为止,我的conf是如下:(他们不工作btw,URL被改变) server { listen 80; server_name www.example.com; root /www; location = / { rewrite ^/(.*)$ splash/$1 permanent; } }
我想创build一个服务,以服务数十万个较小的文件(从5kb到500kb,大部分在10-100kb左右)。 把它想象成一种gravatar.com,它可以在https://secure.gravatar.com/avatar/1545f91437e2576b910dbd1023a44756这些URL上提供这些小的头像图片 我想使用没有任何ID或散列的描述性URL,例如http://www.server.com/This-is-my-file.ext ,没有重复的文件名。 什么是最有效的方式来服务和组织的文件没有太多的开销? 只要将所有内容放在一个目录中并让nginx提供这些文件,就会在一定数量的文件(取决于文件系统)后变慢。 一个想法是基于文件名的第一个字符将文件保存在一个简单的目录结构中,所以这个例子将在T / H / This-is-my-file.ext中用nginxconfiguration中的一个简单的重写规则。 这会导致分配到不同目录的分配非常不均匀。 使用来自允许的值说,文件名的MD5哈希将导致良好的分布,但需要更多的计算能力… 我想这听起来像是一个关键的价值存储的完美的用例,但不是只有文件系统和nginx可以保持简单吗?
我是新来redirect,并很难得到这些工作,我有一个旧站点需要redirect到一个新的网站,相同的域名,但不同的文件夹和域string约1400的URL。 这是我目前没有工作,任何帮助,不胜感激。 谢谢 <rule name="Redirect0001" patternSyntax="ExactMatch" stopProcessing="true"> <match url="www.sitename.com/index.html/_10_12_Slotted_Screwdriver_Bit_2_long?SCREEN=product_ordering&ScreenID=2464&ProductID=952" /> <conditions> <add input="{HTTP_HOST}{REQUEST_URI}" pattern="www.sitename.com/index.html/_10_12_Slotted_Screwdriver_Bit_2_long?SCREEN=product_ordering&ScreenID=2464&ProductID=952" /> </conditions> <action type="Redirect" url="http://www.sitename.com/items.aspx?category=Screwdriver+Bits%2c+Nutsetters+%26+Holders&id=203" /> </rule>
我们的托pipe环境决定了通过特定子域的所有安全stream量音乐旅行。 我们正在使用的.NET CMS Umbraco,据我所知,没有任何function“分配”一个特定的页面到一个子域。 该场景是: 我们的网站包含1页和1个包含必须安全的子页面的文件夹 用户请求/页面或/ page2 /子页面 如果请求来自HTTP,则此stream量将redirect到HTTPS 如果HTTP_HOST不包含子域安全。 然后添加它,否则继续 例如 请求等于/ page2 /页面 301redirect到https:// secure。{http_host} / {request} 随后的请求必须被忽略(为了避免循环) https:// secure.domain.com/page =>无更改,保持不变 https:// domain.com/page =>插入子域,https://secure.domain.com/page 在我看来,逻辑是: INPUT =完整URL = http://www.domain.com/page 如果input包含HTTPS然后检查完整的URL,它是否包含“安全”? 如果是,什么也不做,如果没有添加“安全” – 8月19日更新 考虑到这一点,我拼凑出了两条正确的方向: 这是我build议的: 强制某些stream量进入安全域的一个规则是: <rule name="Force 'Umbraco' to secure" stopProcessing="true"> <conditions logicalGrouping="MatchAll"> <add input="{REQUEST_URI}" pattern="^/umbraco/(.+)$" ignoreCase="true" /> <add input="{HTTP_HOST}" negate="true" […]