Articles of 重写

Nginx重写/path?参数/longer/path.html?params

简单的一个 – 但我宁愿使用位置+重写与如果+重写(如果是邪恶的,正确的?) 旧url:/ app?key = 1234 新的url:/system/app.html?key=1234 试着 location /app { rewrite ^/app$ /system/app.html break; } 只有404 …

nginx + munin“内部redirect周期”

我有一个运行nginx的SSL域,我想能够访问我的munin图/统计在该域。 所以,在域的server块中,我添加了这个: location = /munin/ { alias /var/cache/munin/www/; } 理论上,我应该可以访问http://example.com/munin并显示/var/cache/munin/www/index.html 。 但是,我得到一个500错误,并在error.log这个消息: 2011/08/26 15:21:25 [错误] 19089#0:* 31218重写或内部redirect周期内部redirect到“/index.html”,客户端:1.2.3.4,服务器:domain.com,请求:“ GET / munin / HTTP / 1.1“,主机:”domain.com“ 我尝试了一堆不同的东西,但似乎没有任何工作。 如果有人能够澄清这种情况,我会很感激,也许会想出一个解决scheme。 谢谢! 🙂 这是域的完整configuration,如果有帮助: server { listen 443 default ssl; ## listen for ipv6 ssl_certificate somewhere; ssl_certificate_key somewhere; root /srv/www/domain.com/wwwroot; index index.html index.htm index.php; access_log /srv/www/domain.com/logs/access.log combined; error_log /srv/www/domain.com/logs/error.log; server_name […]

Apache2:重写规则行为奇怪

我有我的.htaccess文件中的以下内容: <Directory /home/eamorr/sites/example.com/www> Options Indexes FollowSymLinks MultiViews Options -Indexes AllowOverride all Order allow,deny allow from all RewriteEngine on RewriteRule ^([^/.]+)/?$ index.php?uname=$1 [R,L] </Directory> 当我访问http://example.com/Eamorr时 , http://example.com/home/eamorr/sites/example.com/www/index.php?uname=Eamorr出现在地址栏中! 但我希望http://example.com/index.php?uname=Eamorr出现在地址栏中! (我需要在index.php中parsingjavascript中的URL)

我应该使用什么redirect规则来replace这个301redirect,在Apache?

我正在使用此指令redirect到HTTPS : <VirtualHost *:80> ServerName foo.bananas.net Redirect 301 / https://foo.bananas.net </VirtualHost> 问题是,当在地址栏中使用path时,如http://bananas.net/webpage ,在https://bananas.netwebpage (无斜杠)失败之前需要暂停一段时间。 应该使用重写规则吗? 应该怎么做,我应该知道的行为有什么不同?

使用Apache2服务器从URL中删除string

这应该是简单的,我已经看了一些现有的问题,但我仍然无法解决我的问题。 我想我只是不能围绕如何RewriteRule和RedirectMatch工作。 我收到了很多服务器请求,例如: http : //www.yogacentersc.es/paginas/38-titulados-por-aipys?iframe=true&width=80%&height=80% 理想情况下,我想永久redirect所有这些不同的页面,减去?iframe和跟随的位。 最好的方法是什么,或者不同的方法来做到这一点?

apache重写> nginx重写

我finnaly有nginx运行 我的网站是用codeigniter制作的,我从我的.htaccess这个旧的重写 #map all request urls to a specific controller method RewriteRule ^(.*)$ index.php?/welcome/domain/$1 [L] 我的问题是如何将其转换为工作的nginx重写规则?

apache,httaccess:写一条规则,使xxxxx.txt的意思是“返回xxxxx.php的源代码”

我不确定这是可能的,但是我想在.htaccess文件中写一个重写规则(如果需要,还有其他的指令),这样对于那个文件夹中的每一个url,任何以.txt结尾的URL都会被重写以.php结尾的相同名字,但是另外,在这种情况下,php文件不被执行,但是其内容(源代码)被服务。 也就是说,“我的文件夹”是我想要应用的文件夹: http://www.mydomain.com/myfolder/somescript.php =>像往常一样运行somescript.php http://www.mydomain.com/myfolder/somescript.txt =>将返回somescript.php的源代码没有运行它

IIS7:rewriteMap相当于完全匹配规则

我在mydomain.com/mysite有一个网站,我想在IIS7中configuration一组redirect。 要从mydomain.com/mysite/old.aspxredirect到mydomain.com/mysite/new.aspx我可以这样写: <system.webServer> <rewrite> <rules> <rule name="test" patternSyntax="ExactMatch" stopProcessing="true"> <match url="old.aspx" /> <action type="Redirect" url="new.aspx" /> </rule> </rules> 但是为了得到与重写映射相同的结果,我必须指定/mysite/ part: <rewriteMaps> <rewriteMap name="TestRewriteMap"> <add key="/mysite/old.aspx" value="/mysite/new.aspx" /> </rewriteMap> </rewriteMaps> <rules> <rule name="Redirect rule1 for TestRewriteMap"> <match url=".*" /> <conditions> <add input="{TestRewriteMap:{REQUEST_URI}}" pattern="(.+)" /> </conditions> <action type="Redirect" url="{C:1}" appendQueryString="false" /> </rule> </rules> 有没有一种方法可以避免在重写映射url中指定网站名称?

IIS 7.5中的URL重写不起作用

我正尝试将所有http通信redirect到https,因为该站点需要SSL。 例如,如果有人导航到http://site.com或http://www.site.com,我想将用户redirect到https://www.site.com 现在,用户获得了403.4 Forbidden错误 – 您尝试访问的页面使用安全套接字层(SSL)进行保护。 我已经尝试了一些不同的URL重写规则,但没有一个似乎工作。 实际上没有什么事情发生,就像模块甚至没有正常工作一样。 首先,我的规则是正确的吗? 如果是这样,还有什么可以防止这个工作正常? <rewrite> <rules> <rule name="Redirect all http traffic to https" enabled="true" stopProcessing="true"> <match url="(.*)" ignoreCase="true" /> <conditions> <add input="{HTTPS}" pattern="off" /> </conditions> <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="true" redirectType="Permanent" /> </rule> </rules> </rewrite>

(可能)简单的mod_rewrite – 重新映射我的网站的url

这个问题使我疯狂。 我已经试过阅读大量有关如何使用mod_rewrite的教程,但是我无法理解它。 这些问题一定会被问到,所以看起来像一个愚蠢的道歉。 我的问题是这个。 我需要将几个请求URL重新映射到我的WordPress的安装。 WordPress的也使用mod_rewrite …链接工作正常吗? 我需要做的重写是: example.com – > example.com/site example.com/blog – > exaple.com/site/categories/blogposts example.com/site/blog – > exaple.com/sites/categories/blogposts 理想情况下,我想重新映射url,而不是执行redirect,但如果没有其他解决scheme,可以忍受它。