这篇文章主要围绕通过configurationapache的.conf文件将httpredirect到https展开,旨在为您提供一份详细的参考资料。我们将全面介绍通过configurationapa
这篇文章主要围绕通过configurationapache的.conf文件将httpredirect到https展开,旨在为您提供一份详细的参考资料。我们将全面介绍通过configurationapache的.conf文件将httpredirect到https,同时也会为您带来.htaccess 301将所有httpsredirect到http EXCEPT ONE PAGE、.htaccess – 将httpredirect到https排除特定的url、.htaccess将httpredirect到https、.htaccess重写规则强制将httpsredirect到http的实用方法。
本文目录一览:- 通过configurationapache的.conf文件将httpredirect到https
- .htaccess 301将所有httpsredirect到http EXCEPT ONE PAGE
- .htaccess – 将httpredirect到https排除特定的url
- .htaccess将httpredirect到https
- .htaccess重写规则强制将httpsredirect到http
通过configurationapache的.conf文件将httpredirect到https
我已经通过代码来configurationapache到tomcat的configuration
<VirtualHost *:80> ServerName captiveportal ProxyPass / http://ip:port/path ProxyPassReverse / http://ip:port/path </VirtualHost>
现在我想将这个请求redirect到https我怎么能实现这个?
看你的答案后,我已经改变了我的configuration
<VirtualHost *:443> SSLEngine on SSLCertificateFile "/etc/httpd/conf/crt1.crt" SSLCertificateKeyFile "/etc/httpd/conf/key1.key" ProxyPass / http://ip:port/path </VirtualHost> <VirtualHost *:80> ServerName captiveportal Redirect / https://ip:port/path </VirtualHost>
但是当我在我的浏览器上键入captiveportal它redirect我的urlhttps://ip:port/path ,它显示problem loading page
Nginx代理服务器本地权限被拒绝
Python socket.accept()没有收到任何连接请求
如何在Git上configurationsocks5代理
与Ubuntu的Android SDK设置代理
如何在端口80上运行Node.js?
还有一件事我不想在浏览器上显示https://ip:port/path 。
注意: – https://ip:port/path其中端口是我的tomcat端口,ip是在tomcat运行的机器ip。
mod_rewrite不作为内部代理工作
Socket.io/WebSockets不断重新连接 – 问题与Nginx的代理configuration?
如何configurationNginx代理到rails应用程序? 所以我不必说domain.com:port
git-svn忽略http代理(debian)
使用Nginx代理外部图像
你可以做这样的事情:
<VirtualHost *:80> serverName captiveportal Redirect / https://my.host.name/ </VirtualHost>
…然后将您的ProxyPass指令放在您的SSL VirtualHost块中。
总结
以上是小编为你收集整理的通过configurationapache的.conf文件将httpredirect到https全部内容。
如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。
.htaccess 301将所有httpsredirect到http EXCEPT ONE PAGE
这里是我目前在我的.htaccess文件中的代码:
Options +FollowSymLinks RewriteEngine on RewriteBase / RewriteCond %{HTTP_HOST} ^example.com [NC] RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301] RewriteEngine On RewriteCond %{HTTPS} on RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
我知道重写关于这个问题的所有其他post真的不符合我的标准,我不知道足够的语言来试图破译它。
基本上我需要的是这样的:
将“example.com”的所有实例redirect到“www.example.com”
将“ https //www.example.com”的所有实例redirect到“ http://www.example.com ” ,但1页除外 ! (万一它很重要,该页面的文件名是payments.PHP)
我有上面的代码工作,但对于我需要为HTTPS的1页,它是重写URL为http。 那一页必须是https。
Apacheredirect – .htaccess – ReWriteCond
为什么不.htaccess有什么作用?
我如何在.htaccess文件中定义variables并使用它?
如果不是带有apache的目录,则删除结尾的斜杠
将子文件夹redirect到root并将其隐藏在url中
谢谢,克里斯
如何在1and1共享主机上configurationCake 2.3.x的htaccess文件
如何在.htaccess中从一个子域redirect到另一个子域?
有子目录不使用Apache的.htaccess密码保护
在.htaccess中使用基于环境variables的RewriteCond
Apache从子域重写到www,但保留所有永久链接
Apache / 2.2.6(Win32)mod_ssl / 2.2.8 OpenSSL / 0.9.8g PHP / 5.2.6
我已经在本地进行了测试,所有用例似乎都正常工作。 如果您还有其他问题,请随时询问。
# Rewrite Rules for example.com RewriteEngine On RewriteBase / # Redirect from example.com to www.example.com RewriteCond %{HTTP_HOST} ^example.com [NC] RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] # Turn SSL on for payments RewriteCond %{HTTPS} off RewriteCond %{SCRIPT_FILENAME} /payments.PHP [NC] RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L] # Turn SSL off everything but payments RewriteCond %{HTTPS} on RewriteCond %{SCRIPT_FILENAME} !/payments.PHP [NC] RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [R=301,L]
重要! 当用户从带有www的任何https页面导航到没有 www的任何https页面时,他被要求接受你的非www域名的安全证书。
例如(YES =请求接受证书,NO – 反面):
1) https://www.asdf.com/payments.PHP - YES (www.asdf.com) 2) http://www.asdf.com/PHPinfo.PHP - NO 3) https://asdf.com/PHPinfo.PHP - YES (asdf.com) 4) https://www.asdf.com/PHPinfo.PHP - NO
我尝试在.htaccess中重新排序规则,但没有成功。 如果有人找到更好的解决方案,将不胜感激。
除了威廉姆斯的伟大的解决方案之外,你可以在https重写之前取消请求
RewriteCond %{REQUEST_URI} !^/?payments.PHP
这是一个很好的帖子,它似乎重定向到http,但我想要一些像下面的东西
RewriteCond %{HTTP_HOST} ^site.com RewriteRule (.*) http://www.site.com/$1 [R=301,L] #RewriteCond %{SERVER_PORT} !^443$ #RewriteRule ^products https://www.site.com/products/ [R=301,L] # disable SSL on pages other than payments.PHP RewriteCond %{HTTPS} on RewriteCond %{REQUEST_URI} !^products RewriteRule ^(.*)$ http://www.site.com/$1 [R=301,L] # Require SSL on payments.PHP RewriteCond %{HTTPS} !on RewriteCond %{REQUEST_URI} ^products/?$ RewriteRule ^(.*)$ https://www.site.com/$1 [R=301,L] RewriteCond $1 !^(index.PHP|images|js|css|static|img|payment|robots.txt|blank.gif) RewriteRule ^(.*)$ index.PHP/$1 [L]
我的网址是http://www.sitename.com和尾随正斜杠是可选的,我需要的是,如果没有文本的产品在url中,那么它需要他http:://,如果有一个字符串产品在那么uri应该是https:://
如何做到这一点…当我试图这是一个循环…重定向循环。
我使用codeigniter框架的工作,我已经从url中删除index.PHP。
所以如果像http://sitename.com/products发生,那么我想它是https://sitename.com/products
如果没有在网址中的产品,那么它应该重定向到http://
# Rewrite Rules for example.com RewriteEngine On RewriteBase / # Redirect from example.com to www.example.com RewriteCond %{HTTP_HOST} ^example.com [NC] RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L] # disable SSL on pages other than payments.PHP RewriteCond %{HTTPS} on RewriteCond %{REQUEST_URI} !^payments.PHP$ RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L] # Require SSL on payments.PHP RewriteCond %{HTTPS} !on RewriteCond %{REQUEST_URI} ^payments.PHP$ RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
我没有测试过,但类似的东西应该工作
编辑:更新
总结
以上是小编为你收集整理的.htaccess 301将所有httpsredirect到http EXCEPT ONE PAGE全部内容。
如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。
.htaccess – 将httpredirect到https排除特定的url
如何将httpredirect到https排除特定的url?
http://www.example.com/* => https://www.example.com/* http://www.example.com/nonssl/* => http://www.example.com/nonssl/*
所以我使用.htaccess文件如下:
RewriteEngine On RewriteCond %{HTTPS} off RewriteCond %{REQUEST_URI} !^/nonssl/ RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
但是,当我去http://www.example.com/nonssl/testfunc ,它转到https://www.example.com/index.PHP/nonssl/testfunc 。
提前致谢。
重写问题 – L(ast)不被尊重?
将/ ch-de /中的urlredirect到/ de /并使用?redirecturl 和“
Apache Mod-Rewrite Primers?
覆盖服务器上的.htaccess文件
如何阻止通过IP访问一组url模式?
.htaccessredirect仅适用于部分url
在Apache 1.3中使用htaccess作为root用户的子目录
IP范围.htaccess文件mod_rewite
redirect需要.htaccess帮助
删除index.PHP url重写.htaccess
对于这个问题,我没有找到正确的方法,只是描述所有的服务重定向从http到https。
RewriteEngine On RewriteCond %{HTTPS} off RewriteCond %{REQUEST_URI} ^/$ [OR] RewriteCond %{REQUEST_URI} ^/test [OR] RewriteCond %{REQUEST_URI} ^/test1 [OR] RewriteCond %{REQUEST_URI} ^/test2 RewriteRule ^(.*)$ https://www.example.com/$1 [R,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond $1 !^(index.PHP|images|css|fonts|js|robots.txt) RewriteRule ^(.*)$ index.PHP?/$1 [L]
我知道这只是不推荐的方式。 如果谁能解决这个问题,就连接我吧。 谢谢。
总结
以上是小编为你收集整理的.htaccess – 将httpredirect到https排除特定的url全部内容。
如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。
.htaccess将httpredirect到https
我有一个旧的url(www1.test.net),我想redirect到https://www1.test.net
我已经在我的网站上实施并安装了我们的SSL证书。
这是我的旧文件.htaccess:
RewriteEngine On RewriteRule !.(js|gif|jpg|png|css|txt)$ public/index.PHP [L] RewriteCond %{REQUEST_URI} !^/public/ RewriteRule ^(.*)$ public/$1 [L]
我怎样才能configuration我的.htaccess文件,以便url自动redirect到https?
谢谢!
使用HTACCESS隐藏URL中的文件夹
防止在htaccess中redirect文件夹
.htaccess在多个环境中
将文件夹redirect到包含文件夹的子域
.htaccess通过虚拟主机的基本身份validation?
2016年更新
由于这个答案得到了一些关注,我想暗示一个更推荐的方式来做这个使用虚拟主机: Apache:重定向SSL
<VirtualHost *:80> serverName mysite.example.com Redirect permanent / https://mysite.example.com/ </VirtualHost> <VirtualHost _default_:443> serverName mysite.example.com DocumentRoot /usr/local/apache2/htdocs SSLEngine On # etc... </VirtualHost>
老回答,哈克东西给你的ssl端口没有设置为80,这将工作:
RewriteEngine on # force ssl RewriteCond %{SERVER_PORT} ^80$ RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
请注意,这应该是您的第一个重写规则。
编辑:此代码执行以下操作。 RewriteCond(ition)检查请求的serverPort是80(这是默认的http-port,如果你指定了另一个端口,则必须调整它的条件)。 如果是这样,我们匹配整个网址(.*)并将其重定向到https-url。 %{SERVER_NAME}可能会替换为特定的网址,但这种方式您不必更改其他项目的代码。 %{REQUEST_URI}是TLD(顶级域名)之后网址的一部分,因此您将被重定向到您来自的地方,而不是https。
我使用以下命令将我的域的所有页面从http重定向到https:
RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
请注意,这将重定向使用301 ''permanently moved''重定向,这将有助于转移您的搜索引擎优化排名。
使用302 ''temporarily moved''改变重定向[R=302,L]
这对于www和https,代理而不是代理用户来说是最好的。
RewriteEngine On ### WWW & HTTPS # ensure www. RewriteCond %{HTTP_HOST} !^www. [NC] RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] # ensure https RewriteCond %{HTTP:X-Forwarded-Proto} !https RewriteCond %{HTTPS} off RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] ### WWW & HTTPS
我用以下代码强制https:
RewriteEngine on RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
寻找重定向的最佳方法,我发现这(来自html5boilerplate):
# ---------------------------------------------------------------------- # | HTTP Strict Transport Security (HSTS) | # ---------------------------------------------------------------------- # Force client-side SSL redirection. # # If a user types `example.com` in their browser,even if the server # redirects them to the secure version of the website,that still leaves # a window of opportunity (the initial HTTP connection) for an attacker # to downgrade or redirect the request. # # The following header ensures that browser will ONLY connect to your # server via HTTPS,regardless of what the users type in the browser''s # address bar. # # (!) Remove the `includeSubDomains` optional directive if the website''s # subdomains are not using HTTPS. # # http://www.html5rocks.com/en/tutorials/security/transport-layer-security/ # https://tools.ietf.org/html/draft-ietf-websec-strict-transport-sec-14#section-6.1 # http://blogs.msdn.com/b/ieinternals/archive/2014/08/18/hsts-strict-transport-security-attacks-mitigations-deployment-https.aspx Header set Strict-Transport-Security "max-age=16070400; includeSubDomains"
也许这将在2017年帮助别人!
总结
以上是小编为你收集整理的.htaccess将httpredirect到https全部内容。
如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。
.htaccess重写规则强制将httpsredirect到http
我有一个主域名https://www.domain.com或https://domain.com和像https://domain.com/index.PHP?name=abcd强制通过http://abcd.domain.comredirect的通配DNS http://abcd.domain.com但我有另一个问题,我的login页面是https://domain.com/login.PHP?name=abcd ,我想结果像强制http://domain.com/login.PHP?name=abcd但它不能在HTTP上redirect。
RewriteEngine On #match either the www subdomain or no subdomain RewriteCond %{HTTP_HOST} ^(?:www.)?(?:domain.com)$ #which request index.PHP RewriteCond %{REQUEST_URI} ^/index.PHP #and contain a username paramater RewriteCond %{QUERY_STRING} ^(.*?)(?:^|&)name=([^&]+)(.*?)$ #then rewrite them to name.domain.com without the name parameter RewriteRule ^ http://%1.domain.com%{REQUEST_URI} [R,L] #match either the www subdomain or no subdomain RewriteCond %{HTTP_HOST} ^(?:www.)?(?:domain.com)$ #which was requested without https RewriteCond %{HTTPS} off #then redirect to https RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R,L] #Capture subdomain RewriteCond %{HTTP_HOST} ^([^.]+).(?:domain.com)$ #If we're not working on www RewriteCond %{HTTP_HOST} !^(?:www.domain.com)$ #If querystring doesn't contain name RewriteCond %{QUERY_STRING} !^(.*?)(?:^|&)name=([^&]+)(.*?)$ #Add username to querystring RewriteRule index.PHP index.PHP?name=%1 [L,QSA]
这个htaccess的代码工作正常,但我想login脚本在htaccess
在聊天澄清后,这是我所需要的:
所有的URL都应该被重写为https ,除了login.PHP ,它应该停留在http 。 如果login.PHP以https ,请将其重写为http 。
请求的资源.htaccess上不存在Access-Control-Allow-Origin标头
mod_rewrite不适用于Windows 7上的Apache 2.2
Apache .htaccess隐藏.PHP和.html扩展名
如何使mod_rewrite从子域redirect到查询string?
如果不是带有apache的目录,则删除结尾的斜杠
我怎样才能设置CORS访问我的Linux Web服务器上的audio文件与Apache2?
在htaccess中禁用PHP函数
多国使用.htacces
无法获取.htaccess mod_rewrite规则工作 – 404找不到
.htaccess:如果调用特定的目录,则重写整个URL
你已经有重写为https的规则,唯一剩下的就是不包括login.PHP
RewriteCond %{HTTP_HOST} ^(?:www.)?(?:domain.com)$ RewriteCond %{HTTPS} off RewriteCond %{REQUEST_URI} !^/login.PHP$ RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=302,L]
如果用 https请求login.PHP ,则将其重写为http
RewriteCond %{HTTP_HOST} ^(?:www.)?(?:domain.com)$ RewriteCond %{HTTPS} on RewriteRule ^login.PHP$ http://%{HTTP_HOST}%{REQUEST_URI} [R=302,L]
最后,一个小提示: 从不测试301启用,看到这个答案提示调试.htaccess重写规则的细节。
尝试这个 :
RewriteEngine On RewriteCond %{HTTPS} on RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI}
我们今天的关于通过configurationapache的.conf文件将httpredirect到https的分享就到这里,谢谢您的阅读,如果想了解更多关于.htaccess 301将所有httpsredirect到http EXCEPT ONE PAGE、.htaccess – 将httpredirect到https排除特定的url、.htaccess将httpredirect到https、.htaccess重写规则强制将httpsredirect到http的相关信息,可以在本站进行搜索。
本文标签: