Articles of 重写

lighttpd 1.5反向代理到trac

我运行lighttpd 1.5刚刚编译closuressvn。 我有一个Trac守护进程监听8000端口,我想代理所有匹配^http://xx.xx.xx.xx/trac(*.)请求到守护进程。 这是它在我的.conf中的样子: $HTTP["host"] == "xx.xx.xx.xx" { $HTTP["url"] =~ "^/trac" { proxy-core.balancer = "round-robin" proxy-core.protocol = "http" proxy-core.backends = ( "127.0.0.1:8000" ) proxy-core.rewrite-response = ( "Location" => ( "^http://xx\.xx\.xx\.xx/(.*)" => http://xx.xx.xx.xx/trac/$1" ), ) proxy-core.rewrite-request = ( "_uri" => ( "^/trac/?(.*)" => "/$1" ), "Host" => ( ".*" => "xx.xx.xx.xx" ), ) } xx.xx.xx.xx是可以公开访问的IP,在端口80上。 部分原因是因为当我浏览到http://xx.xx.xx.xx/trac我在Trac中看到了我的可用项目(即由127.0.0.1:8000/服务的页面),而其他任何不以/ […]

从包含网站的文件夹redirect

我有一个网站从这个URL到达: http://www.mysite.com/cms/index.php 从这个目录提供服务: public_html/cms/index.php 在public_html我有这个.htaccess RewriteRule (.*) cms/$1 [L] 这让我到这样的网站: http://www.mysite.com/index.php 但是现在如果我引用“旧”地址,我想用redirect代码redirect到重写的地址。 例如: http://www.mysite.com/cms/?q=node/1 is redirected to… http://www.mysite.com/?q=node/1 我怎样才能做到这一点? 编辑:也在Drupal(cms)提供的.htaccess文件,这是写。 我试过启用它,但似乎没有任何效果。 # Modify the RewriteBase if you are using Drupal in a subdirectory or in a # VirtualDocumentRoot and the rewrite rules are not working properly. # For example if your site is at http://example.com/drupal […]

nginx图像重写

是否有可能重写图像? 图像存储在/very/big/path/1.jpg,我想/img/1.jpg如何做到这一点?

在单个域的vhost.config中使用mod rewriteredirect问题

我们在一个networking解决schemeVPS上,四个域名都是一个IP。 在单个域的vhost.config文件中,以下内容将起作用: Redirect 301 /1234 http://example.com/ 但以下3个重写将不起作用: RewriteEngine On RewriteRule ^1234$ / [R=301,L] Options +FollowSymlinks RewriteEngine On RewriteRule ^1234$ / [R=301,L] Options +FollowSymlinks RewriteEngine On RewriteRule ^1234$ http://example.com [R=301,L] 这些只是testing,以获得一些更严重的事情与mod重写在vhost.config。 我觉得我必须错过简单的东西。 如果任何人都可以帮助我,这将不胜感激。

Nginx的尾部斜杠重写不起作用

我有一个使用子目录的网站,目前只有当结尾的斜杠被添加到URL(“ http://www.domain.com/dir/ ”)时才起作用。 当没有结尾斜线时,我得到“无法连接到服务器domain.com:8080”(8080是Nginx设置的监听端口)。 我尝试添加在这里 (和这里 )build议的重写,但它会导致整个虚拟主机的“无法连接”错误。 是否有另一种方法来添加我可以尝试的尾部斜杠? 或者,有没有一种方法可以将其configuration为将URL看作目录(从而查找索引文件),而不pipe是否存在尾部斜杠?

redirect.php扩展名?

我非常,非常(非常!)使用国防部重写新…我有以下设置在我的htaccess,它的工作原理如预期删除.php扩展名。 我的问题是如何让url不扩展,如果有人把任何扩展到url的结尾? 现在http://www.example.com/share等工作,但也是http://www.example.com/share.php 。 我想删除这些页面上的任何扩展名! Options +FollowSymlinks RewriteEngine on # remove php extension from all matching files RewriteRule ^(share|invite|submission|thankyou|confirm|over|report)$ $1.php [NC] 我已经尝试了几件事情,总是最终破坏这两个function。 由于某些原因,这些东西是find快速的谷歌答案最不可能的事情。 提前致谢! 更新:以某种方式工作,但获得无限的redirect循环: Options +FollowSymlinks RewriteEngine on # reslove extensionless urls RewriteRule ^(share|invite|submission|thankyou|confirm|over|report|emailtest)$ $1.php [NC] # make .php redirect to extensionless urls RewriteRule ^(share|invite|submission|thankyou|confirm|over|report).php$ /$1 [R=301,L,QSA]

RewriteRule不能在.htaccess中工作,但没有错误

我有一个重写规则,它不工作,但它不会抛出任何错误,所以我无法弄清楚。 .htaccess文件如下所示: RewriteEngine On RewriteBase /site/ RewriteRule ^help/(.*)\.html$ /site/help.php?topic=$1 [L] 另外,在httpd.conf有 <Directory "/Users/user/Sites"> Options Indexes FollowSymLinks ExecCGI Includes AllowOverride All Order allow,deny Allow from all </Directory> 编辑:我有XAMPP(1.7.3)在Mac OS 10.6.7 我究竟做错了什么? 谢谢!

在nginx中configurationURL重写

我试图为我的MVC框架设置URL重写,但因为这是我第一次使用Nginx,我有一点麻烦。 我的应用程序有两个接入点: /index.php /admin/index.php 我需要将这些文件夹/访问点的URL路由到相应的索引文件,例如: /admin/auth/login/ >>> /admin/index.php?/auth/login/ /contact/ >>> /index.php?/contact/ 这是我迄今为止: #Project server { listen 7000; listen localhost:7000; location / { root /srv/www/htdocs/ASDDL/; index index.php; } location /admin/ { root /srv/www/htdocs/ASDDL/admin/; index index.php; } location ~ \.php$ { fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /srv/www/htdocs/ASDDL/$fastcgi_script_name; fastcgi_pass 127.0.0.1:9000; include fastcgi_params; } } 现在,你可以看到,我认为问题在于以下行: fastcgi_param SCRIPT_FILENAME /srv/www/htdocs/ASDDL/$fastcgi_script_name; 那里没有路由到pipe理文件夹,因为它试图路由到根index.php文件,任何人都可以阐明正确的方式来做到这一点?

Apache子域在URL中代表参数的子域redirect

我正在更新我的htaccess文件来控制一个正在创build的子域。 我遇到了一些问题。 首先,我build立了http://m.domain.com/这个域名,并指向http://www.domain.com/mobile.php/mobile 我希望这样的工作,因为我不想经过一个大的过程重构当前设置的URL路由,并修复它,这样会更容易。 我也想这个在我的开发机器上本地工作。 所以下面的url也适用: http : //local.m.domain.com和本地网站redirect到http://local.domain.com/mobile.php/mobile 这意味着,如果我传递参数后,说:: http://m.domain.com/page它会然后路由到页面http://www.domain.com/mobile.php/mobile/page 到目前为止,我有,但这只是下载一个PHP文件,而不是路由任何页面。 RewriteCond %{HTTP_HOST} (^local\.|^)m\.domain\.com\.au$ [NC] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ mobile.php\/mobile$1 [QSA] 我知道,本地或“没有”select器的正则expression式是懒惰的,但我不认为这是什么杀死它。 当然,我可能是错的。 任何提示或build议将感激地接受。

301redirect一个URL很长的短划线

在我正在寻找的网站上,我需要做一个301redirect的url,它有一个很长的破折号,但它不工作。 我的redirect在UrlRewriting.config中,如下所示: <add name='blog1' virtualUrl='^~/news/blog/2011/08/cookies-%E2%80%93-crunch-time-for-website-operators$' destinationUrl='/news/blog/2011/08/crunch-time-for-website-operators' redirect='Application' ignoreCase='true' redirectMode='Permanent' /> 正如你所看到的,任何一方都有一个连字符是很长的。 任何想法为什么这个redirect不会工作? 谢谢!