我们正在运行Tomcat的EC2中安装Java Web应用程序。 该应用程序使用用户图片(静态内容)的文件夹 – > www.example.com/PICTURES 我们使用mod_jk从服务path/ PICTURES中排除Tomcat,所以它是Apache服务的。 我们正计划将/ PICTURES移至S3并从我们的存储桶中提供服务。 在我们的代码中,我们使用短url,例如,用户图片被定义为:/PICTURES/1.jpg 我们希望将每个来自www.example.com/PICTURES/*的电话redirect到我们的存储桶 – > example.com.s3-website-us-east-1.amazonaws.com/PICTURES 我们一直在寻找最好的策略,但似乎并不是一个统一的解决scheme。 据我所知,我们应该使用: a)mod_rewrite:为每个静态内容创build正则expression式,我们将redirect到你的存储桶 b)代理:作为S3的代理人工作 有没有其他解决scheme? 优缺点都有什么?
我有一个域domain.com并做了一个子域“forum.domain.com”。 我正在使用Apache2并添加一个A record到DNSlogging,并将virtualNameServer作为: <VirtualHost *:80> ServerName forum.domain.com DocumentRoot /var/www/vanilla <Directory /var/www/vanilla> # This relaxes Apache security settings. AllowOverride all # MultiViews must be turned off. Options -MultiViews allow from all </Directory> ErrorLog "|/usr/sbin/rotatelogs /etc/httpd/logs/vanilla-error.%Y-%m-%d.log 86400" CustomLog "|/usr/sbin/rotatelogs /etc/httpd/logs/vanilla-access.%Y-%m-%d.log 86400" "%h %l %u %t %D \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" </VirtualHost> 在子域中,我安装了Vanilla Forum Software 。 但是,现在的问题是,每当我去http://domain.com或http://www.domain.com […]
为了强化一个面向公众的networking服务器,我和我的同事提出了一个计划,让Apache对某些请求进行“黑洞”。 例如,请求phpmyadmin(这是不运行)或其他明显的黑客/恶意企图,我们希望Apache甚至没有响应。 我知道Apache可以发送各种错误或使用mod_rewrite空数据响应,但我想尽可能less发送它们,所以理想情况下…没有。
我在我的lighttpdconfiguration文件中有以下mod_rewrite指令: url.rewrite-once = ( "foo.*$" => "static/foo.pdf", ) 我想http://<server>/foo/r=ca2b912这样的URL: http://<server>/foo/r=ca2b912 (或类似),以便我可以跟踪http访问日志中链接的来源。 当我inputhttp://<server>/foo/r=131ab42时,会显示“save-as”文件对话框,并build议命名文件r=131ab42 (至less在使用firefox时)。 我想build议foo.pdf作为文件名保存。 这应该独立于访问该URL的工具(即wget,IE等应该都将该文件保存为foo.pdf )。 我怎样才能做到这一点? 我注意到,Firefox重新加载URL时更正了文件名。 请注意 :这是我第一次使用重写规则。 我试图自己find答案,但没有成功。
在Apacheconfiguration文件(如ServerAlias , RewriteRule ,…)中有什么东西有通配线 *.example.com 还包括根 example.com 还是必须单独添加此条目(如ServerAlias *.example.com example.com )?
我有两个服务器上安装的Web应用程序。 在其中一台服务器上,当我访问主页时,在浏览器中出现“错误代码:ERR_TOO_MANY_REDIRECTS”错误,而另一台服务器正常工作。 两台服务器都运行apache 2.4。 Apacheconfiguration的哪一部分与redirect规则有关? 我应该在哪里寻找两种configuration之间的差异? 以防万一,这里是htaccess文件: <IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine On # Get rid of index.php RewriteCond %{REQUEST_URI} /index\.php RewriteRule (.*) index.php?rewrite=2 [L,QSA] # Rewrite all directory-looking urls RewriteCond %{REQUEST_URI} /index.php/$ RewriteRule (.*) index.php?rewrite=1 [L,QSA] # Try to route missing files RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} public\/ [OR] RewriteCond %{REQUEST_FILENAME} \.(jpg|gif|png|ico|flv|htm|html|php|css|js)$ RewriteRule . […]
我有我的configuration文件设置如下所示: <VirtualHost *:80> RewriteEngine on RewriteCond %{HTTPS} off RewriteRule (.*) https://example.com/%$1 [R,L] </VirtualHost> <VirtualHost *:443> ServerAdmin webmaster@localhost DocumentRoot /ssd/www/ SSLEngine on SSLCertificateFile /ssd/certs/example_com.crt SSLCertificateKeyFile /ssd/certs/example_com.key SSLCertificateChainFile /ssd/certs/example_com.ca-bundle ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> 问题是,当它redirect时浏览到一个标准的HTTP页面附加/%25/到域,所以例如.. http://example.com更改为https://example.com/%25/更改为https://example.com/%25/my-category/my-page 。
我已经inheritance了一个Web应用程序,并且在下面是一组.htaccess规则。 在我看来,他们什么都不做。 有人可以解释他们在做什么吗? 对我来说,它看起来像只匹配到站点根目录,检查目录是否不存在(!),然后301redirect到站点根目录。 RewriteCond %{REQUEST_URI} /$ RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.+)/$ $1 [L,R=301]
我写了一个基于HTTP_HOST(www.domainname.com)的RewriteRule,但是我希望它只在域名部分(domainname.com)的基础上工作。 进一步澄清 该文件夹结构是/var/www/domainName.com 。 当我写这个规则在Apache的configuration文件 RewriteRule ^/js/(.*) /%{HTTP_HOST}/js/$1 [L] 并访问该网站使用www.mydomain.com – 它试图find文件夹/var/www/www.domainName.com ,它不存在。 所以,我需要转换上述规则,从HTTP_HOST中删除“www”。
当我去/索引/testing我得到/index.php/test。 我想能够从/ index / page1改写为/index.php?page=1,但即使没有任何.htaccess文件,我得到索引文件没有variables。 似乎我的服务器被设置为猜测扩展名,并获得文件,如果它存在。 是具有标准configuration(apache2)的Mac OS X Server 10.6。 有任何想法吗?