我正在尝试根据经过身份validation的用户重写一个url。 但REMOTE_USER总是空的。 authentication工作。 我在这里很困惑…我错过了什么? RewriteEngine On RewriteLog "/var/log/httpd/rewrite.log" RewriteLogLevel 3 <Directory /home/storage> Order Allow,Deny Allow from all Dav On Options Indexes AllowOverride None AuthName "Webdav: insert your username and password" AuthType Basic AuthBasicProvider ldap AuthLDAPBindDN cn=adsyncldapagent,ou=Service,ou=AdminUsers,ou=ITS,dc=xx,dc=xx AuthLDAPBindPassword xxxx AuthzLDAPAuthoritative On AuthLDAPURL "ldap://xxxx/ou=Staff,ou=AUM,dc=xx,dc=xx?sAMAccountName?sub" <LimitExcept GET POST> Require valid-user </LimitExcept> </Directory> RewriteCond %{REQUEST_URI} ^/webdav RewriteRule . /home/storage/%{LA-U:REMOTE_USER}p […]
相同的Apache重写规则在VHost中工作(匹配),但不在“.htaccess”文件中: <VirtualHost *:80> ServerName 192.168.1.100 ServerAlias example.com DocumentRoot /test RewriteEngine On RewriteRule ^/test.html$ /test2.html RewriteLog "/tmp/rewrite.log" RewriteLogLevel 9 <Directory "/"> AllowOverride All </Directory> </VirtualHost> 重写日志: 192.168.1.10 – – [13/May/2013:16:19:31 +0100] [example.com/sid#7fd764555ed0][rid#7fd764ad9758/initial] (2) init rewrite engine with requested uri /test.html 192.168.1.10 – – [13/May/2013:16:19:31 +0100] [example.com/sid#7fd764555ed0][rid#7fd764ad9758/initial] (3) applying pattern '^/test.html$' to uri '/test.html' 192.168.1.10 – – […]
我读了httpd.conf中的一个目录块就像一个.htaccess文件。 这是否意味着RewriteEngineOn可以在httpd.conf中多次使用? 我假设它可以但它必须放在目录块。 有人可以证实吗?
上下文 遵循以下规则: # Redirect root url to /tvs RewriteRule ^/$ /tvs [R=301,L] 我有一个绝对的redirect,如: HTTP/1.1 301 Moved Permanently Server: nginx Date: Fri, 24 Mar 2017 16:42:23 GMT Content-Type: text/html; charset=iso-8859-1 Content-Length: 312 Location: http://www.tvsvizzera.it/tvs Vary: Accept-Encoding X-Node: pcache02 X-Cached: MISS Proxy-Connection: Keep-Alive Connection: Keep-Alive 并在rewrite.log中我有以下几点 10.101.114.1 – – [24/Mar/2017:16:43:34 +0100] [www.tvsvizzera.it/sid#7fd446c22168][rid#7fd446d6eb48/initial] (2) init rewrite engine with […]
我有一个Apache虚拟主机,执行一些重写操作(使用mod_rewrite)所请求的url。 其中一些RewriteRule调用将浏览器redirect到其他主机(使用301和302redirect)。 我已经在该虚拟主机文件中设置了1秒的默认期限: ExpiresActive On ExpiresDefault "access plus 1 second" 因此,所有的redirect都包含这个标题: Cache-Control: max-age=1 现在我想要做的是在一个特定的redirect的情况下输出一个不同的caching头。 我希望大部分的redirect(302s)会持续1秒到期,但是其中一个(301),我想用1天的到期。 这是可行的吗?
我的网站最近受到DOS攻击,似乎已经通过安装mod-evasive(这很好) 我想find用于攻击的IP,所以我很自然地去了access.log,只发现了数百行: 127.0.0.1 – – [08/Oct/2011:22:08:33 +0200] "OPTIONS * HTTP/1.0" 200 – "-" "Apache/2.2.9 (Debian) PHP/5.3.8-1~dotdeb.1 with Suhosin-Patch (internal dummy connection)" 127.0.0.1 – – [08/Oct/2011:22:09:22 +0200] "OPTIONS * HTTP/1.0" 200 – "-" "Apache/2.2.9 (Debian) PHP/5.3.8-1~dotdeb.1 with Suhosin-Patch (internal dummy connection)" 127.0.0.1 – – [08/Oct/2011:22:09:23 +0200] "OPTIONS * HTTP/1.0" 200 – "-" "Apache/2.2.9 (Debian) PHP/5.3.8-1~dotdeb.1 with […]
最近我注意到我的服务器一直在通过netstat -na发送数据到奇怪的位置“121.11.76.48”。 为了找出它发送的是什么,我试了一下: tcpdump -i eth0 host 121.11.76.48 -nnvvXSs 1514 并发现它不断发送HTTP请求到这个位置: 22:55:21.179353 IP (tos 0x0, ttl 64, id 26103, offset 0, flags [DF], proto: TCP (6), length: 296) 192.168.1.13.58155 > 121.11.76.48.80: P, cksum 0x880b (incorrect (-> 0xd884), 1904784743:1904784999(256) ack 915059568 win 46 0x0000: 4500 0128 65f7 4000 4006 4ce8 c0a8 010d E..(e.@[email protected]….. 0x0010: 790b 4c30 […]
是否有可能使用mod_rewrite强制所有用户进入一个网站(通过从另一个网站的链接,或通过在地址栏中键入一个url)被redirect到主页? 从主页(或站点内的任何页面),用户应该能够访问站点中的其他页面。 但所有的用户将被迫通过主页进入该网站。 这可以用mod_rewrite(或不使用脚本语言)完成吗?
我有一个网站,通过ssl完全servered。 我需要通过http允许在单个页面上的外部连接。 目前在我的http.conf中有 <VirtualHost *:80> .. Redirect permanent / https://www.mysite.com/ .. </VirtualHost> 我想在这里添加一个例外,我只想要一个特定的页面,而不是通过redirect,如果可能的http … http://www.mysite.com/directory/page.php 我尝试添加以下内容,但是这当然本身工作得很好,但是与上面的内容一起创build了redirect循环。 <VirtualHost *:443> .. RewriteEngine on RewriteCond %{SERVER_PORT} ^443$ RewriteRule ^/directory/page$ http://www.mysite.com/directory/page.php [R=301,L] .. </VirtualHost>
我有用于testing的 .htaccess文件,这里是我的文件: RewriteEngine On RewriteCond %{REQUEST_URI} ^/([az-]+)/?$ [NC] RewriteRule ^ %{REQUEST_SCHEME}://%{SERVER_NAME}/?title=%1 [L] 我使用ApacheLounge的 Apache / 2.4.10(Win32) 我有以下域和子域: example.com m.example.com 两者都指向相同的IP地址,现在正如我从上面的.htaccess预期的那样: 如果我访问example.com/Article-Name/redirect到example.com/?title=Article-Name将是内部的 ,我将无法在我的url栏上看到?title=Article-Name 。 这是一个例外: 如果我访问m.example.com/Article-Name/ ,redirect到m.example.com/?title=Article-Name将是外部的 ,现在我在我的url中看到m.example.com/?title=Article-Name酒吧。 所以我期待着同样的行为,如果有人有一个想法,我会非常感激。 编辑: 我已经find了解决这个问题的方法,但是我仍然对上面的问题感兴趣,关于解决scheme是使用: RewriteRule ^ ?title=%1 [L] 请注意:这个解决scheme只需要m.example.com ,我真的不知道这个解决scheme是如何工作的,我已经发布了这个解决scheme,因为它可能有助于找出上述问题的原因,以及这个解决scheme如何工作。 编辑2(完整的.htaccess文件): RewriteEngine On <If "%{HTTP_HOST} = 'avielfadida.ml'"> # The actual condition is really long one so I replaced it […]