htaccess的所有重定向到https访问http除了一个文件夹 [英] htaccess redirect all to https to http except for one folder

查看:125
本文介绍了htaccess的所有重定向到https访问http除了一个文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道为什么我找不到这样或这样做,但基本上所有我想做的事就是我的重定向服务器到https的任何页面://除非是在文件夹/ fbthumbnails /因为Facebook没有按' ŧ让缩略图是https://开头。

I don't know why I can't find this or do this but basically all I want to do is redirect any page on my server to https:// unless it is in the folder /fbthumbnails/ because facebook doesn't allow thumbnails to be https://.

推荐答案

在.htaccess文件中使用mod_rewrite,坚持这一个适当的位置

Using mod_rewrite, stick this in an appropriate place in your .htaccess file

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/fbthumbnails/
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI}  [R,L]

更改研究 R = 301 如果你想永久重定向。

Change the R to R=301 if you want a permanent redirect.

这篇关于htaccess的所有重定向到https访问http除了一个文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆