Articles of 重写

Apache Proxy和Rewrite,将目录追加到URL

我有一个从本地networking运行在http://10.0.2.20/的后端服务器,其服务类似于: / (root) | |_user1/ | |_www/ | |_private/ | |_user2/ |_www/ |_private/ (etc.) 访问http://10.0.2.20/user1/当然包含“www”和“私人”文件夹,并通过公共服务器使用Apache的反向代理进行代理。 我喜欢它,所以发生以下事情: http://public-proxy-server/user1/实际显示http://10.0.2.20/user1/www/中的内容,而不在URL中指明。 (/ private /不能通过公共代理服务器访问)。 这里的关键是它是dynamic的,所以对http://public-proxy-server/*/所有请求应该显示来自http://10.0.2.20/*/www/内容。 再次,代理目前正常工作; 下面是configuration: (在公共服务器上) <VirtualHost *:80> ServerName www.domain.com ProxyRequests Off ProxyPreserveHost On ProxyVia full ProxyPass / http://10.0.2.20/ ProxyPassReverse / http://10.0.2.20/ </VirtualHost> (在后端服务器上) <VirtualHost *:80> … #this directory contains folders 'user1' and 'user2' DocumentRoot /var/www/ … […]

Apache URL重写

假设我在www.domain.com/products/上有内容 在产品文件夹中,我有几个HTML文件都以“big-”开头。 例如: big-product01.html big-product02.html 如何重写我的URL,以便可以通过键入以下内容来访问这些URL: www.domain.com/products/big/product01 www.domain.com/products/big/product02 … 在此先感谢您的任何帮助!

如何将ServerAlias – 请求redirect到ServerName并服从请求中的子目录?

我希望将所有stream量redirect到example.com/* ,以redirect到www.example.com/* 我发现如何将任何ServerAliasredirect到相应的ServerName? 它处理有关的主题,并做了四个upvotes答案build议: RewriteEngine On RewriteCond %{HTTP_HOST} !^www.example.com [nocase] RewriteRule ^(.*)$ http://www.example.com$1 [last,redirect=301] 不过,这会将stream量redirect到http://example.com/subdirectory而不是 http://www.example.com而不是 http://www.example.com/subdirectory 。 在这个问题上的任何药物?

如何从URL使用重写规则去除string

可能重复: 一切你想知道Mod_Rewrite规则,但不敢问? 有时候,我的drupal网站添加额外的string图像的url,导致图像被打破。 url是 http://mysite.com/sites/default/files/imagecache/list_image_page/%252F sites / default / files / img.jpg 什么是需要重写规则去除上面的链接粗体(%252F)的一部分 即。 成为: http://mysite.com/sites/default/files/imagecache/list_image_page/sites/default/files/img.jpg 我已经尝试过,但没有工作 RewriteCond%{QUERY_STRING} ^(。*)\%252Fsites(。*)$ RewriteRule%{REQUEST_URI}%1sites%2

简单的NGinx重写就是redirect

我试图为我的Nginx服务器上运行的网站设置一个友好的URL,但由于某种原因,url正在被redirect,而不是被重写。 例如,如果用户访问mydomain.com/aboutme/我想mydomain.com/aboutme/留在地址栏中,但要从mydomain.com/aboutme.php 在我的Nginx站点configuration中,我有以下几个(简单的例子,为了简单起见,一些东西被砍掉): server { listen 1.2.3.4:80; server_name www.mydomain.com; location / { rewrite ^/aboutus/$ http://www.mydomain.com/aboutus.php permanent; } } 不pipe出于什么原因,Nginx似乎坚持将友好的urlredirect到php文件,但是我想要一个更传统的“重写”(就像我之前在Apache mod_rewrite中所做的一样)。 我可能做错了什么,但是如果我能弄清楚什么的话,我会被诅咒的。

Apache重写debian vs windows

我刚刚了解他们,我有简单的重写规则 RewriteEngine On RewriteRule ^dl/(.*)/.*$ dl/$1/index.php [L] RewriteRule ^index.php$ upload.js [L] 这两个工作都在Windows的url localhost/upload/dl/mkdji/index.php ,但在Debian上只有www.domain.com/index.php第二条规则,而不是www.domain.com/dl/oksoks/index.php dl是一些随机string。 很明显,我错过了关于目录深度的东西,但不知道是什么。 文件htacces在localhost/upload和domain.com文件夹的根。 我在这里错过了什么?

nginx负载均衡器重写监听端口

我已经使用nginx实现了负载均衡器,如下所示: 上游lb_units { 服务器127.0.0.1:88权重= 7 max_fails = 3 fail_timeout = 30s; #反向代理到BES1 服务器10.200.200.107 weight = 1 max_fails = 3 fail_timeout = 30s; #反向代理到BES2 服务器10.200.200.94 weight = 1 max_fails = 3 fail_timeout = 30s; #反向代理到BES2 } 服务器{ 听80; server_name mysite.com; 位置 / { proxy_set_header X-Real-IP $ remote_addr; proxy_set_header X-Forwarded-For $ proxy_add_x_forwarded_for; proxy_set_header主机$主机; proxy_pass http:// lb_units; proxy_redirectclosures; […]

redirecturl使用RewriteRule

我有一个网站,说example.com/drupal在xampp上运行 我已经将httpd.conf中的DocumentRoot更改为/ drupal /,以便我可以使用example.com访问我的网站 但Google已经抓取了我的网站,并显示了表单的结果 example.com/drupal/something 这当然要去404页。 我如何使用RewriteRulesredirect example.com/drupal/something 至 example.com/something?

nginx重写规则从子域的服务器图像?

我希望我的所有图像(jpg | gif | png)目前从mydomain.com/files/被服务器从我从static.mydomain.com设置到服务器文件的第二台机器上被切断。 我想知道如何定义nginx重写规则来做到这一点? 谢谢

如何使url重写规则exception?

我有一堆重写规则redirect访问从domainX到domainY,但现在我想显示一个index.html页面,当人们访问domainX,但我仍然希望所有其他重写规则适用。 我读了stackoverflow,我可以在顶部添加这样的东西: RewriteRule ^index.html – [L] 然而它不工作。 我不知道为什么。 有什么build议么? 注意:当前的重写configuration文件在这里可用。