不允许在登录页上使用https版本


Do not allow https version on landing page

我只想禁止https版本用于登录页&这就是"index.php"。然而,当我访问网站"www.example.com"时,index.php并不被称为&所以.htaccess文件没有得到它是什么。直到现在,我一直在使用以下代码:

RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule ^index'.php$ http://www.example.com [L,R=301]

如果我这样做:

RewriteRule https://www.example.com http://www.example.com [L,R=301]

这似乎不起作用。有什么帮助吗?此外,我只想重定向特定的登录页面,因为对于登录&这样的页面我重定向到https版本。

这应该适用于您:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^$
RewriteCond %{HTTP_HOST} ^domain.com$
RewriteRule ^$ https://example.com/index.php [L,R=301]

像这样,您可以将只通过http://example.com访问您网站的人重定向到http://example.com/index.php。之后,我刚刚添加了您已经存在的.htaccess code,它现在应该可以正常工作,因为index.php被称为