2015-09-22 21 views
1

下面是我使用禁用home.php页面上SSL htaccess的代码,但它不是working.`使用htaccess在home.php上禁用SSL不起作用?

RewriteEngine On 
RewriteCond %{HTTPS} off 
RewriteRule ^home.php(.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] 
+2

'但它不工作'这是什么意思?什么不起作用?它在做什么或不做什么?但是,我看到的是,如果https未使用,您将重定向到https。那么......你试图完成什么? –

+0

如果'https'不工作(第3行),你为什么要重定向到“https”? –

+0

@ShawnMehan这是一个错字,我更新了上面的代码,我的服务器是通过SSL和home.php我想禁用SSL。 –

回答

3

它不工作,因为你的代码是倒退。如果你想打 https为home.php你需要检查https是不关闭。

RewriteEngine On 
RewriteCond %{HTTPS} ^on 
RewriteRule ^home\.php$ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] 

根据你的评论,你需要排除home.php。

RewriteEngine On 
RewriteCond %{HTTPS} off 
RewriteCond %{REQUEST_URI} !^/home\.php$ [NC] 
RewriteRule ^(.*)$ https://www.my-site.com/$1 [R=301,L] 
+0

实际上,我将所有用户重定向到https://使用htaccess,因此使用相同的代码块实现此代码会导致问题。 以下是我将所有用户重定向到https://的代码,所以我如何才能将它们重定向到http:// home.php 'RewriteEngine On RewriteCond%{SERVER_PORT} 80 RewriteRule^(。*)$ https://www.my-site.com/$1 [R,L]' –

+0

我更新了答案以说明您的其他规则。你现在可以使用这两个规则,它应该适合你。 –