Can not log in to Drupal 7 admin after changing to HTTPS. Access Denied and cookie not set

只谈情不闲聊 提交于 2019-12-12 05:07:16

问题


I can no longer log into Drupal 7's admin area after adding SSL certificate and forcing HTTPS in url.

The website was previously served via HTTP protocol and worked perfectly fine. I would also like to mention that if I revert back to HTTP mode, the site will work as expected. However, I am trying to implement HTTPS.

Additionally, while logging in, I have noticed that the cookie response would be sent by the server but it would get deleted immediately leading to access denied message.

So far, after going through mixed response in the internet, I have played around with session.cookie, $base_url and $cookie_domain variables within settings.php file. I haven't found a solution yet.

Has anyone bumped into this problem? Your response will be highly appreciated.


回答1:


Disable in .httaccess
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\.example\.com*
RewriteRule ^(.*)$ https://example.com/$1 [L,R=301]



回答2:


In apache server
Go to .httaccess
Add # in front of RewriteRule ^ - [E=protossl] to disable http
It looks like this # RewriteRule ^ - [E=protossl]
This solves the problem




回答3:


Ok so this is a fairly old post but here is what happened with my site.

We installed a new SSL certificate and somehow the .htaccess file ended up empty, and I do mean 100% blank.

This means easy fix, download latest drupal core and just replace the .htaccess file along with the core files, usually you want skip this to preserve all additional code added for html compression and such, but in this case that is redundant.

After the .htaccess was replaced I then added the compression and rerouting code like before and problem solved.

Hope this helps someone else out, I know I will always be checking the .htaccess files first if it happens again.



来源:https://stackoverflow.com/questions/37110061/can-not-log-in-to-drupal-7-admin-after-changing-to-https-access-denied-and-cook

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!