我正在做一个path重写设置和环境variables,这将导致mod_jk使用特定的JBoss服务器。 适用于任何应用程序path。 当我尝试我们的监视servelet(做一个简单的数据库来certificate堆栈是可操作的),它匹配重写,重写,设置env var,但却无法实际处理URL的第二次。 为什么通过重写引擎第二次旅行的不一致行为? 模式是,如果/workername/被预先添加到path中,它将删除,但将该值用作mod_jk装载的JK_WORKER_NAME 。 configuration示例: SetHandler jakarta-servlet SetEnv JK_WORKER_NAME mexico RewriteEngine on RewriteRule ^/(mexico[1-2])/(.*)$ /$2 [E=JK_WORKER_NAME:$1,L] (mod_jk工人被命名为mexico1和mexico2) 点击https://hostname/mexico2/public/gateway.sf得到重写,然后第二遍通过重写引擎,由mod_JK处理并传递给应用程序服务器。 一切顺利,看到日志(向右滚动好位) 10.1.1.163 – – [26/Aug/2013:14:10:44 –0400] [publisher.internal.test.hnw.com/sid#2ad8c96bc310][rid#2ad8bde6fae0/initial] (2) init rewrite engine with requested uri /mexico2/public/gateway.sf 10.1.1.163 – – [26/Aug/2013:14:10:44 –0400] [publisher.internal.test.hnw.com/sid#2ad8c96bc310][rid#2ad8bde6fae0/initial] (3) applying pattern '.*' to uri '/mexico2/public/gateway.sf' 10.1.1.163 – – [26/Aug/2013:14:10:44 –0400] [publisher.internal.test.hnw.com/sid#2ad8c96bc310][rid#2ad8bde6fae0/initial] […]
我有一个networking服务器,完全用基本身份validationlocking <Location /> AuthType Basic # […] rest of basic auth stuff require valid-user order deny,allow deny from all Satisfy any </Location> 一个子目录无需授权即可访问: <Location /public> allow from all Satisfy any </Location> 这工作正常。 现在我想允许访问而不login一些使用mod_rewrite访问的脚本: RewriteRule ^phonebook/show/(.+)$ /quicksearchShow.php?uid=$1 [NC] RewriteRule ^phonebook/(.+)$ /quicksearch.php?s=$1 [NC] RewriteRule ^phonebook$ /quicksearch.php [NC] 我尝试了一些方法: <Location ~ "/phonebook*"> Allow from all Satisfy Any </Location> […]
我目前正在运行托pipe我的networking和gitlab服务器的CentOS以及托pipe一个亚音速服务器的Windows机器。 目前,我的IP指向CentOS,但没有正确redirect。 我能够访问/但无法访问任何其他网站的子域,尽pipe我已经做了设置,所以我想知道我要去哪里错了,如何纠正这个问题。 当人们inputhttp://git.example.com ,是否也可能自动将其redirect到https://git.example.com ? 提前致谢! NameVirtualHost *:80 #This should lead to subsonic server <VirtualHost *> ServerName music.company.com ServerAlias www.music.company.com ProxyRequests Off <Proxy *> Order deny,allow Allow from all </Proxy> ProxyErrorOverride On ProxyPass / http://192.168.1.14:6060/ ProxyPassReverse / http://192.168.1.14:6060/ <Location /> Order allow,deny Allow from all </Location> </VirtualHost> Gitlab.conf LoadModule ssl_module modules/mod_ssl.so SSLSessionCache "shmcb:logs/ssl_scache(512000)" <VirtualHost […]
编辑:[解决]最后在文档中find解决scheme; 张贴了一个答案。 简而言之: DPI标志。 编辑:在底部,增加了一个简单的方法来重现在线问题。 我花了几个小时debugging一些重写。 一切都很好,只有一种行为让我感到困惑。 不知何故,当一个URL有两个或更多的子目录时,mod_rewrite自动将所有的子目录(除了第一个)附加到重写的url。 这是我可以减less的最简单的例子。 这是在DOCUMENT_ROOT的htaccess。 url: http://localhost/stripthis/stripthat RewriteRule ^ RewriteWasHere_ 输出: RewriteWasHere_/stripthat 那条stripthat从哪里来的? 上游有一些select可能导致这种情况吗 我试图用各种规则剥离子文件夹。 例如: url: http://localhost/stripthis/stripthat RewriteRule ^/?([^/]+) RewriteWasHere_$1 输出: RewriteWasHere_stripthis/stripthat 奇怪的是,这发生在本地xampp x Apache 2.4.7和远程CentOS x Apache 2.2上。 我一直在通过将它们输出到脚本来检查重写的URL,但是这里有一个方法来在线重现这个问题。 如何重现此在线 去这个在线htaccesstesting 对于该url,请inputhttp://example.com/a/123/b 对于规则,粘贴这个: # the `(?!)` negative lookaheads are just to make triple sure # we're not running […]
我有一套mod_rewrite的要求,这是我的头。 任何提示/指针,将不胜感激: 域: www.domain-europe.com www.domain.com www.domain-europe.com的请求应该redirect到www.domain.com/europe www.domain-europe.com/someurl的请求应redirect到www.domain.com/someurl 任何其他请求到非www.domain-europe.com或www.domain.com服务器应该被设置为www.domain.com 我可以做任何1和3或2和3这些工作,但不是所有三个在同一时间。 这是我尝试过的许多迭代之一: RewriteEngine on RewriteCond %{HTTP_HOST} ^www\.domain-europe\.com$ [NC] RewriteRule (.*) http://www.domain.com/europe [R=301,L] RewriteCond %{HTTP_HOST} ^www\.domain-europe\.com/ [NC] RewriteRule (.*) http://www.domain.com$1 [R=301,L] RewriteCond %{HTTP_HOST} !^www\.domain\.com [NC] RewriteCond %{HTTP_HOST} !^$ RewriteRule ^/(.*) http://www.domain.com/$1 [L,R]
我已经尝试了两天将.htaccess转换为nginx重写原始文件如下所示: # Turn on URL rewriting RewriteEngine On RewriteBase // # Protect hidden files from being viewed <Files .*> Order Deny,Allow Deny From All </Files> # Protect application and system files from being viewed RewriteRule ^(?:application|modules|system)\b.* index.php/$0 [L] # List of files in subdirectories will not be displayed in the browser Options -Indexes # Allow […]
我想在我的.htaccess中添加一个指令,例如,如果浏览器指向包含%E4 (?)的URI或任何其他特殊字符,则.htaccess自动将%E4 (?)重写为%C3%A4 ä )。 总之,我想.htaccess将Win-1252百分比编码转换为UTF-8百分比编码。 我知道我可以通过添加一系列的mod_rewrite规则来做到这一点 – 但我想知道是否有一个本地.htaccess指令,将照顾到这一点。 ==== 这是迄今为止我自己已经得到的(我在.htaccess中的条目比在下面的列表中有更多的条目,但是为了示例目的,我已经删减了列表以供参考): RewriteRule ([^\ä]*)\ä([^\ä]*\ä[^\/]*)(\/[.*])? $1%C3%A4$2$3 [N] RewriteRule ([^\ä]*)\ä([^\ä]*)$ http://www.domain.com/$1%C3%A4$2 [NE,R=301] RewriteRule ([^\é]*)\é([^\é]*\é[^\/]*)(\/[.*])? $1%C3%A9$2$3 [N] RewriteRule ([^\é]*)\é([^\é]*)$ http://www.domain.com/$1%C3%A9$2 [NE,R=301] RewriteRule ([^\î]*)\î([^\î]*\î[^\/]*)(\/[.*])? $1%C3%AE$2$3 [N] RewriteRule ([^\î]*)\î([^\î]*)$ http://www.domain.com/$1%C3%AE$2 [NE,R=301] RewriteRule ([^\ö]*)\ö([^\ö]*\ö[^\/]*)(\/[.*])? $1%C3%B6$2$3 [N] RewriteRule ([^\ö]*)\ö([^\ö]*)$ http://www.domain.com/$1%C3%B6$2 [NE,R=301] RewriteRule ([^\ü]*)\ü([^\ü]*\ü[^\/]*)(\/[.*])? $1%C3%BC$2$3 [N] RewriteRule ([^\ü]*)\ü([^\ü]*)$ http://www.domain.com/$1%C3%BC$2 [NE,R=301] 有人知道吗: 1)我怎样才能整理这个? 2)如果URI中有多个特殊字符(单个或多个),则不起作用。 有没有什么简单的方法来确保规则将处理多个特殊字符?
我想阻止networking爬虫使用configuration为将所有请求转发到ProxyPass的apache站点。 我已经尝试过BrowserMatchNoCase指令来设置一个环境variablesblock_spider。 当我在我的networking浏览器中更改我的用户代理以伪装成search机器人时,它仍然允许我访问该网站。 BrowserMatchNoCase "^bingbot" block_spider BrowserMatchNoCase "^msnbot" block_spider <Proxy *> Order deny,allow Deny from env=block_spider Allow from all </Proxy> RewriteEngine On RewriteOptions Inherit
我正在试图做一个caching系统的文件。 而我正在考虑使用国防部重写服务caching的文件,如果它存在,或PHP文件(这将创buildHTML静态caching),如果没有。 这是我想出的第一个样本 <IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^$ /cache/home.html [L,NC] RewriteCond %{REQUEST_URI} /cache/ RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^cache/home.html /index.php [L] RewriteRule ^page/([0-9]*) /cache/page_$1.html [L,NC] RewriteCond %{REQUEST_URI} /cache/ RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^cache/page_([0-9]*).html /page.php?&id=$1 [L] </IfModule> 这适用于内部页面。 如果我打电话给http://www.example.site/page/1或http://www.example.site/page/2它正确地服务caching的文件或php页取决于文件是否存在。 问题是它不适用于主站点http://www.example.site 如果我为家庭添加一个redirect标志,它实际上工作正常 RewriteRule ^$ /cache/home.html [L,NC,R] 但是,很显然,在这种情况下,如果我打电话给主站点,并且服务于http://www.example.site/cache/home.html这不是我正在寻找的。 这里有几行日志,其中的问题可能是: [Wed Aug 05 11:59:11.751277 2015] [rewrite:trace1] [pid 30670] mod_rewrite.c(468): […]
我有一个与多个域名链接到它的虚拟主机。 我正在尝试发送额外的标头,当一个特定的域名请求。 这就是我正在做的(在.htaccess的vhost中都尝试过,结果是一样的) SetEnvIf HOST thishost THETAG=noindex Header set X-Robots-Tag "%{THETAG}e" env=THETAG Header set X-Robots-Test "Yes" 所以基本上,X-Robots-Test标题应该始终存在。 如果设置了THETAG标题,则只有当主机标题包含“thishost”时才设置X-Robots-Tag。 RewriteRule看起来像这样,所以基本上301从页面1redirect到page2 RewriteRule page1 page2 [L,R=301] 当对page2发出请求时,头部显示正确,但是当对page1发出请求(并且由mod_rewriteredirect)时,头部不存在(甚至没有testing头部)。 当从PHP脚本而不是mod_rewrite启动redirect时,它会显示标题,所以我认为问题在于mod_rewrite在mod_headers上是优先的。 有没有什么办法解决这一问题?