Articles of 重写

在用nginx重写uri时出错

这是我们在ubuntu 12.04服务器上加载nginx的错误: nginx: [emerg] invalid number of arguments in "location" directive in /opt/nginx/conf/nginx.conf:58 我们要做的是在input的uri末尾添加一个string。 例如,如果inputmysite.com/abcd或mysite.com/abcd/ ,则nginx应将其rewrite为mysite.com/abcd/auth/signin 这里是我们在nginx.conf : location { rewrite "/[a-zA-Z]\w{1,9}/" /$1/auth/signin last; rewrite "/[a-zA-Z]\w{1,9}" /$1/auth/signin last; } } 上面的位置块有什么问题,我们应该如何命名位置块? 谢谢您的帮助。 更新: 这里是nginx.conf中的server块: server { listen 80; server_name mysite.com; root /var/www/; passenger_enabled on; rails_env production; passenger_base_uri /nbhy; … }

用nginx重写URL

我最近使用nginx设置了一个虚拟主机。 托pipe的网站需要将包含'/old/'urlredirect到没有'/old/'url。 例如: www.mywebsite.com/old/a/b/c to www.mywebsite.com/a/b/c www.mywebsite.com/old/a to www.mywebsite.com/a www.mywebsite.com/old/a/b/c/d/e to www.mywebsite.com/a/b/c/d/e 任何人都可以指向正确的方向吗? 干杯

.htaccess将URL重写为域中的大写字符

例如,我想要foob​​ar.com显示FooBar.com 这几乎工作,但结束了强制redirect循环: RewriteEngine On RewriteCond %{HTTP_HOST} ^(www.)?foobar.com\.com RewriteRule ^(.*)$ http://FooBar.com/$1 [L,R=301] 有没有办法做到这一点? 我知道这很奇怪,但我只是好奇,如果有可能没有结束在一个循环。

非工作nginx重写规则与多个参数

我试图用nginx创build一个重写规则,它用一个参数重写一个不存在的图像uri给dynamic页面,但是失败。 /images/395.4b2a-c6b.large-red/car-image.jpg 至 /thumb.php?param1=4b2a6aa&param2=c6bc&id=395&size=large&color=red 请求中的参数详细信息是: 395 . 4b2a – c6b . large – red /blabla-image.jpg id . 4 char hash – 3 char hash . size – color 颜色受限于:red | 蓝色| 绿色 尺寸也是有限的:小| 大 我的非工作重写规则是: location ~* \.(jpg)$ { rewrite ^/images/([0-9-]+)\.[a-zA-Z0-9]{4}+\-[a-zA-Z0-9]{3}+\.(.*)\-(.*)/(.*)$ /thumb.php?id=$1&param1=$2&param3=$3&size=$4&color=$5 last; } 这条规则有什么问题? 有任何想法吗?

Ngnix重写 – 如果URL包含

我有一个小问题 – 我的错误日志填满了我的网站上的目录文件夹的请求(但添加的数据不应该在那里)。 http://example.com/the-directory/undefined http://example.com/the-directory/administrator http://example.com/the-directory/admin http://example.com/the-directory/script 如何设置重写,以便包含以下内容的任何请求: /the-directory/{any extra data} 301redirect到 /the-directory/ 我所尝试的是: rewrite ^/the-directory/(.*)$ /the-directory/ last; 但是,这只是陷入redirect循环。 任何帮助将不胜感激。

StatusWolf 0.8.8 GUI问题:在Apache访问日志中findURLpath中的“/ undefined /”

我在Ubuntu 12.04上安装了StatusWolf 0.8.8,运行Apache 2.2.22和PHP 5.4.23。 我使用以下方法检索了最新的Git源代码: git clone https://github.com/box/StatusWolf.git 并遵循这里的安装说明: https://github.com/box/StatusWolf/wiki/Installation 我可以login,但无法创build任何graphics。 在调查的过程中,我发现Apache日志中的URLpath中有“/ undefined /”。 例如,当我login时,selectDashboard,然后select菜单项Dashboard / Add Widget / Graphing Widget,会生成以下Apache访问日志条目: 192.168.100.110:9653 192.168.100.102 – – [08/Jan/2014:13:27:09 -0800] "POST /undefined/api/get_saved_searches HTTP/1.1" 200 1755 "http://192.168.100.110:9653/dashboard" "Mozilla/5.0 (Windows NT 5.2; rv:14.0) Gecko/20100101 Firefox/14.0.1" 192.168.100.110:9653 192.168.100.102 – – [08/Jan/2014:13:27:09 -0800] "GET /undefined/app/js/lib/bootstrap-datetimepicker.js HTTP/1.1" 200 1755 "http://192.168.100.110:9653/dashboard" "Mozilla/5.0 (Windows […]

w3wp.exe崩溃(rewrite.dll)IIS 7.5

在生产服务器的最后几天,我遇到了一些崩溃,我无法弄清楚如何解决这个问题。 服务器托pipe以传统ASP编写的电子商务应用程序,该应用程序在IIS 7.5 + MSSQL下运行。 自从星期一以来,大约每天有一次w3wp.exe进程因模块rewrite.dll中的访问冲突而崩溃。 没有更新最近安装,没有补丁的应用程序代码,显然没有任何改变。 有没有人有类似的经验,可以参考我的解决scheme? 在此先感谢,这是来自debugging诊断的崩溃挂起分析报告。 Type of Analysis Performed Crash Analysis Machine Name Operating System Windows Server 2008 R2 Service Pack 1 Number Of Processors Process ID 456 Process Image C:\Windows\SysWOW64\inetsrv\w3wp.exe System Up-Time 7 day(s) 02:04:17 Process Up-Time 6 day(s) 23:09:21 Thread 10 – System ID 5640 Thread 10 – System […]

如何根据源IPredirect到https?

我有一个运行apache访问的网站 内部(rfc1918地址空间)作为http://hostname或http://hostname.local 外部(公共地址空间)为https://example.org 。 当内部用户从10.0.1.0/24地址空间访问http://hostname/*或http://hostname.local/*上的任何页面时,如何redirect访问,以便将它们发送到https://hostname.example.org上的相关页面https://hostname.example.org 警告我有两个子网10.0.1.0/24,我想要做的https和10.0.2.0/24,我不想做 HTT的时刻 我现在所拥有的是 RewriteEngine On RewriteBase / RewriteCond %{REMOTE_HOST} 10\.0\.1 RewriteRule .* https://hostname.example.org/ [R=301,L] 但我不知道如何做到这一点,所以如果用户转到http://hostname[.local]/test ,用户被发送到https://hostname.example.org/test

IIS 7 URL重写不起作用

入站IIS7 Url重写规则不起作用 以下是我定义的URL重写规则。 <rewrite> <rules> <rule name="Redirect domain.co.uk to www.domain.co.uk" enabled="true" stopProcessing="true"> <match url="^domain\.co\.uk(.*)" /> <action type="Redirect" url="http://www.domain.co.uk{R:1}" /> </rule> </rules> </rewrite> 当我去domain.co.uk它不是redirect到www.domain.co.uk。 难道我做错了什么?

Apache重写URL

我有我的文档DocumentRoot设置为www/fg 。 之前,我通过inputhttp://www.mydomain.com/www/fg来浏览www/fg 。 然后,我设置了指向www/fg VirtualHosts 。 现在我只需键入http://www.mydomain.com 。 问题是我的Web开发人员写了一些链接,如www/fg/image.png 。 而且这些链接不再可用。 有一种方法可以告诉Apache重写任何链接,如http://www.mydomain.com/www/fg/image.png to http://www.mydomain.com/image.png? 我也会改变链接像http://www.mydomain/www/fg/somelink到http://www.mydomain.com/somelink 。 同样的https。 问候