Topic: Bad HTTP Referrer (not mentioned in the sticky post)

I was changing the base URL in the admin console.

It was "http://domain.com/forums" but I wanted to change it to "http://www.domain.com/forums" but I accidentally left out the "." after "www" so it said "http://wwwdomain.com/forums" without the period after "www".

Now whenever I try to fix it and click save changes I just get a BAD HTTP REFERRER.  Please help!

Re: Bad HTTP Referrer (not mentioned in the sticky post)

Yes it is, that falls under the referrer not being set correctly tongue
Set the referrer directly in the database (config table, conf_name is o_base_url) and then remove the config cache file

Re: Bad HTTP Referrer (not mentioned in the sticky post)

How the heck do you get into the database manually?  You mean I have to extract the whole thing using a mod, edit it, and then restore it?

I read the BAD HTTP sticky because I know it must be annoying when people post questions that are answered right infront of them but I thought this was a different problem, sorry!

Re: Bad HTTP Referrer (not mentioned in the sticky post)

You can use a tool like phpMyAdmin to execute queries on the database directly
Alternately, I believe that you can edit the config cache file to correct the error and then make the correction in admin_options.php

Re: Bad HTTP Referrer (not mentioned in the sticky post)

Yes you are right, I just downloaded config_cache.php and edited the base URL and re-uploaded it, no database work needed.  Everything is fine now, thanks!

Re: Bad HTTP Referrer (not mentioned in the sticky post)

I TAKE THAT BACK! lol

It appeared to have worked but as soon as I tried to do an admin task it happened again and reset the Base URL back to the incorrect one!

Re: Bad HTTP Referrer (not mentioned in the sticky post)

In admin_options.php
FIND AND DELETE

    // Custom referrer check (so we can output a custom error message)
    if (!preg_match('#^'.preg_quote(str_replace('www.', '', $pun_config['o_base_url']).'/admin_options.php', '#').'#i', str_replace('www.', '', (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''))))
        message('Bad HTTP_REFERER. If you have moved these forums from one location to another or switched domains, you need to update the Base URL manually in the database (look for o_base_url in the config table) and then clear the cache by deleting all .php files in the /cache directory.');

then change the base URL in admin_options.php, then put the code back where it should be

Re: Bad HTTP Referrer (not mentioned in the sticky post)

Alright, this time it works even when I go do admin tasks and it stays that way.  Thanks, you're good!