I've just moved a Drupal to my localserver and I forgot to disable Secure Pages.
Now I cannot access admin pages, because the site switches to HTTPS.
How can I disable it?
In your settings.php file:
$conf['securepages_enable'] = FALSE;
This will override the database setting.
In your sites/example.com/settings.php
, leave this line out, and then it will use whatever value is in the database.
If you are using drush, you can keep the Secure Pages module enabled and just turn off the checkbox in the module's own config like:
drush vset securepages_enable 0
This will stop the redirect.
you can also change the URLs if you want, as follows, but the above is usually enough.
drush vset securepages_basepath http://nominet.dev
drush vset securepages_basepath_ssl http://nominet.dev
I'm running Drupal 7 btw, so YMMV, but seems to be a simple drush based solution following on from the above answer.
The way I've done it without disabling the module is to use SQL to change the variable setting. First backup your database (in case you put a semicolon in the wrong place; scratch that, always back up your database before making changes on the command line) and then run the following SQL on your database:
UPDATE variable SET value = 's:1:"0";' WHERE name = 'securepages_enable';
Then:
DELETE FROM cache;
DELETE FROM cache_page;
You need those two lines in order to clear the cache, otherwise the variable might stick around for a while.
I know this question is old and has been answered a few times, but there's another option that hasn't been suggested yet.
You could disable it completely:
// Disable SecurePages completely.
$conf['securepages_enable'] = FALSE;
and alter settings.php to enforce HTTPS depending on some context, e.g.:
if (isset($_SERVER['environment'] && $_SERVER['environment'] == 'staging')) {
$conf['securepages_basepath'] = 'http://staging.example.com';
$conf['securepages_basepath_ssl'] = 'https://staging.example.com';
} else if (isset($_SERVER['environment'] && $_SERVER['environment'] == 'production')) {
$conf['securepages_basepath'] = 'http://www.example.com';
$conf['securepages_basepath_ssl'] = 'https://www.example.com';
} else {
// We're on dev or some other server instance where SSL isn't needed.
$conf['securepages_enable'] = FALSE;
}
This is just an example, but it's been a helpful way for us to manage sites that exist on a dev server, a QA server, and a production server, where we want to track settings.php changes in version control without having to change things in each environment.
If you have Drush installed:
drush dis -y securepages
You can disable the module directly via the database. Just go into the system
table, look for your module under the name
column, and set the status
field to zero.