我怎样才能从https://mysite.comredirect到https://www.mysite.com ? SSL证书是为www.mysite.com购买的,并且在没有www的情况下访问时会显示警告。
我最近安装了NGINX作为我的apache服务器的反向代理来处理静态文件。 到目前为止,一切正常,除了事实上我不能再为我的图像加水印了。 Apache的.htaccess是这样的: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] RewriteRule ^(.*)wp-content/upload/(.*\.(jpg|JPG|jpeg|png))$ $1watermark.php?src=wp-content/upload/$2 </IfModule> 这是我目前的虚拟主机nginx.conf(这是不工作的水印): server { listen 80; server_name mydomain.com www.mydomain.com ; error_log /var/www/vhosts/mydomain.com/statistics/logs/error_log.nginx warn; location / { proxy_pass http://www.mydomain.com:8080$request_uri; include /etc/nginx/proxy.conf; } location ~* ^.+\.(jpg|jpeg|gif|png|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|wav|bmp|rtf|js|ico|swf)$ { root /var/www/vhosts/mydomain.com/httpdocs; expires 7d; } #This here, isnt […]
我已经写了一个dynamic的缩略图创build者的htaccess文件,看看是否存在请求的文件,如果不发送用户到PHP页面来创build它。 我的htaccess文件如下所示: # Check the formatting (this works) RewriteCond %{SCRIPT_FILENAME}%{QUERY_STRING} /([a-zA-Z0-9-]+).(jpg|gif|png)w=([0-9]+)&h=([0-9]+)(&c=(true|false)) # Only forward to thumbnail.php if file doesn't exist #RewriteCond %{REQUEST_FILENAME} !-f #this works but not for the correct filename! RewriteCond %1-%2-%3-%4-%6.jpg !-f # Doesn't work!!! # If file doesn't exist, send here: (this works) RewriteRule ^.*$ thumbnail.php?file_name=%1&type=%2&w=%3&h=%4&c=%6 我检查文件的存在似乎不工作,但是…使用%{REQUEST_FILENAME}的旧版本的作品,但这不是我需要检查的正确的文件名。 我已经validation了新文件%1-%2-%3-%4-%6.jpg具有正确的输出,但不触发条件! 基于以下url: this-is-the-image-name.gif?w=200&h=100&c=true htaccess文件应该检查这个文件是否存在: this-is-the-image-name-gif-200-100-true.jpg […]
好的,我有这个代码: RewriteCond %{HTTPS} off RewriteCond %{REQUEST_URI} ^/borrowing/ill/request\.php$ RewriteRule ^.*$ https://%{HTTP_HOST}%{REQUEST_URI} [R,L] 我期望这个工作的方式是: HTTP请求/borrowing/ill/request.php。 规则匹配。 服务器redirect到HTTPS。 规则不匹配,因为HTTPS现在处于打开状态。 它实际工作的方式是: HTTP请求/borrowing/ill/request.php。 规则匹配。 服务器redirect到HTTPS。 规则匹配。 服务器redirect到HTTPS。 规则匹配。 服务器redirect到HTTPS … 等等。 我知道第二个条件(匹配的文件名)正在工作,因为redirect循环只是命中特定页面。 问题是,为什么不切换到HTTPS导致第一个条件不匹配? 编辑: 我将完全相同的.htaccess规则放到另一台服务器的testing区域 – 相同的文件和path信息。 他们工作得很好 。 其他地方的服务器configuration有问题。
在我的Apache托pipe的Ruby on Rails网站上,一个来自俄罗斯的IP地址(总是相同的)每隔20分钟就根据path请求敲击网站,我认为它试图通过评论表单来提交垃圾评论。 无论如何,我在我的.htaccess文件中完成以下操作,完全启动它们,同时允许其他人… Order Allow,Deny Deny from XX.XX.XX.XXX Allow from all 所以它的工作,他们的IP不再显示在我的Rails日志,他们无法访问该网站。 但是,在/ var / log / apache2文件夹中的网站的错误日志继续由禁用的IP机架相同的错误… [Thu Jun 30 09:11:37 2011] [error] [client XX.XX.XX.XXX] client denied by server configuration: /srv/[…] 这显然是错误的,但我不认为有必要继续logging这个IP被阻止,我想保持我的错误文件清理其他合法的错误。 我怎样才能停止录制这个日志?
我试图find拒绝通过htaccess访问特定文件和文件夹的性能最友好的方式。 (例如一个.git文件夹,一个.hg文件夹,.htaccess文件本身。)是否有一些比其他的更具性能友好的特殊方法或组合? (FilesMatch与DirectoryMatch与RedirectMatch与其他)。
我需要将这个.htaccess转换为Nginx格式,如果可以的话,请指导我。 DirectoryIndex index.php FileETag none ServerSignature Off Options All -Indexes <IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^([0-9a-zA-Z]{1,6})$ links/?to=$1 [L] RewriteRule ^([0-9]{1,9})/banner/(.*)$ links/?uid=$1&adt=2&url=$2 [L] RewriteRule ^([0-9]{1,9})/(.*)$ links/?uid=$1&adt=1&url=$2 [L] </IfModule> 再次感谢…
我使用托pipe的维基服务运行SSL,我有一个CNAME从我的子域redirect到它,但浏览器显示一条消息,说它正在redirect。 有没有办法解决这个问题? 我的主机和托pipe网站的技术不同意做什么(基本上每个人都说,其他人需要做的事情) 目前build立的是: http://wiki.mydomain.org – > https://mydomain.externalhost.org 任何和所有的build议将非常赞赏:) 编辑 我的域正在运行的Apache的服务器,我不知道外部主机(对不起,我不知道版本等技术) 在我的DNS面板中,它指出:这个CNAMElogging将wiki.appsforgood.org指向appsforgood.onconfluence.com。 我应该解释我build议在维基子域上安装SSL证书,但我的主机说这不会停止错误消息,它应该安装在外部主机服务器上。 当然,外部主机说,它需要安装在维基子域,让我把我的头撞在桌子上试图得到一个明确的答案
我需要redirect到文件夹从80到8080 1.默认索引到/ somename 2. / admin到/ somename 我尝试了一个.htaccess RewriteEngine on Redirect / http://example.com:8080/somename Redirect /admin http://example.com:8080/someAdmin 但我正在运行的JSP,所以我使用的文件夹名称是someAdmin(注意大写)我不可能改变我的代码中的path(对此感到遗憾) 问题所以,因为这我得到错误页(CASE sEnSiTive)redirect(自动它在浏览器中转换为小案例) 添加我会很高兴,如果.htaccess可以屏蔽8080端口从用户通过反向代理。 RewriteEngine on RewriteCond %{SERVER_PORT} !^8080$ RewriteRule ^(.*) http://%{SERVER_NAME}:8080/somefolder%{REQUEST_URI} Redirect /admin http://%{SERVER_NAME}:8080/someAdmin
我正在使用.htaccess代码 <IfModule mod_headers.c> <FilesMatch "\.(gif|jpg|png|css|swf|php)$"> Header add "Expires" "Mon, 28 Jul 2014 23:30:00 GMT" Header add "Cache-Control" "max-age=31536000" </FilesMatch> </IfModule> <IfModule mod_expires.c> ExpiresActive On ExpiresDefault A604800 ExpiresByType text/css A604800 ExpiresByType image/gif A604800 ExpiresByType image/png A604800 ExpiresByType image/jpeg A604800 ExpiresByType application/x-shockwave-flash A604800 </IfModule> 问题是,它仍然检查服务器,如果该文件已被修改,然后返回304未修改。 我希望它默认使用caching,即本地浏览器caching,而不是往返服务器。 有什么build议么?