Restoring backup to localhost but redirects to live site instead
Posted by: nickstarbright (---.ph.ph.cox.net)
Date: June 30, 2015 06:37PM

I've read through this forum extensively before deciding to ask for help. Here's what I'm trying to achieve.

I have a live website that's Joomla 3.4.1. I have recently decided to update my wamp from 2.2 to 2.5 due to a misconfiguration between my live host and my localhost.

So I've upgraded my wamp, set up the vhosts as shown here. I installed a fresh copy of joomla just to test it out. c:/wamp/www/joomla1. No problems there, works like a charm.

Then I decided to install an akeeba backup of my live site in another directory. I've done these numerous times on wamp 2.2 and never had an issue.

So here's my problem. When I try to install the akeeba backup which is a jpa file plus a kickstart.php script. The site is restored plus the database. Akeeba throws off no errors. The problem I am getting is when I go to the localhost and select that project instead of connecting to the localhost it fetches the live website url instead.

This is not what I want. I would like a backup of my live site locally so I can test out other features I might update on the live site.

Here's what my vhosts file looks like for my restored live site on localhost:

<VirtualHost *:80>
DocumentRoot "c:/wamp/www/bsm"
ServerName localhost
ServerAlias bsm
<Directory "c:/wamp/www/bsm">
AllowOverride All
Require local
</Directory>
</VirtualHost>


Here's what my hosts file looks like:

127.0.0.1 localhost
127.0.0.1 joomla1
127.0.0.1 bsm

Here's what my httpd.conf looks like:

Listen 0.0.0.0:80
Listen [::0]:80

# Virtual hosts
Include conf/extra/httpd-vhosts.conf


Like I said, my joomla installation went perfectly and works as it should but my restoration of my live site does not, that directory keeps linking to my live site.

Any ideas as to why this is happening. I'm sure it's something simple and hope that's the case.


Thanks in advance!

Options: ReplyQuote
Re: Restoring backup to localhost but redirects to live site instead
Posted by: RiggsFolly (---.as43234.net)
Date: June 30, 2015 08:05PM

As far as I rememeber there is a question in kickstart that asks for the new site name/url along with database etc.

Did you forget to change the url to `bsm` from whatever the live site is called.

However if you have links in articles that use a full url like `<img src="[realsite.com]....` then kickstart wont fix those.

Just a small point but your HOSTS file should read

127.0.0.1 localhost
127.0.0.1 joomla1
127.0.0.1 bsm

::1 localhost
::1 joomla1
::1 bsm

So that it works on the IPV4 and IPV6 address range, unless you have disabled IPV6 in windows.

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: Restoring backup to localhost but redirects to live site instead
Posted by: nickstarbright (---.ph.ph.cox.net)
Date: July 01, 2015 07:57AM

Yes I filled in all the information and changed the site name including database. I also added the following to my host file:

::1 localhost
::1 joomla1
::1 bsm

To my host file, restarted all services and nada.

Closed Wamp and restarted, again nada!

Here's what is what is currently in my vhosts:

<VirtualHost *:80>
DocumentRoot "c:/wamp/www/bsm"
ServerName bsm
ServerAlias bsm
<Directory "c:/wamp/www/bsm">
AllowOverride All
Require local
</Directory>
</VirtualHost>

I've even tried adding this since all of the other lines aren't necessary:

<VirtualHost *:80>
DocumentRoot "c:/wamp/www/bsm"
ServerName bsm
ServerAlias bsm
</VirtualHost>

After restarting, both aliases show up in the 'My Virtual Host' menu but both redirect to the live site. Puzzled!??

Options: ReplyQuote
Re: Restoring backup to localhost but redirects to live site instead
Posted by: RiggsFolly (---.as43234.net)
Date: July 02, 2015 11:02AM

OK,

the HOSTS file should contain references to IPV4 and IPV6 loopback addresses like this

127.0.0.1 localhost
127.0.0.1 joomla1
127.0.0.1 bsm

::1 localhost
::1 joomla1
::1 bsm


Also when you create Virtual Hosts you must define localhost again as when VH's are defined Apache ignores the one defines in httpd.conf

# Should be the first VHOST definition so that it is the default virtual host
# Also access rights should remain restricted to the local PC and the local network
# So that any random ip address attack will recieve an error code and not gain access

<VirtualHost *:80>
    DocumentRoot "c:/wamp/www"
    ServerName localhost
    <Directory  "c:/wamp/www">
    	AllowOverride All
	Require local
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "c:/wamp/www/bsm"
    ServerName bsm
    <Directory "c:/wamp/www/bsm">
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

Quote

I've even tried adding this since all of the other lines aren't necessary:

<VirtualHost *:80>
DocumentRoot "c:/wamp/www/bsm"
ServerName bsm
ServerAlias bsm
</VirtualHost>

The <Directory...> group is necessary as it defines to Apache who is allowed access to this virtual host

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: Restoring backup to localhost but redirects to live site instead
Posted by: nickstarbright (---.ph.ph.cox.net)
Date: July 02, 2015 07:03PM

Okay, as suggested I've changed the vhosts around and again it's still redirecting and connecting to the live site.

This is frustrating because akeeba backups didn't do this on wamp 2.2.

I've updated my vhosts file, host file and it just keeps redirecting to the live site. I'm using firefox and I've cleared the browser cache and flushed the dns cache too.

Patiently waiting for any more suggestions. Again thanks!

Options: ReplyQuote
Re: Restoring backup to localhost but redirects to live site instead
Posted by: RiggsFolly (---.as43234.net)
Date: July 02, 2015 07:40PM

What exactly redirects to the live site?

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: Restoring backup to localhost but redirects to live site instead
Posted by: nickstarbright (---.ph.ph.cox.net)
Date: July 02, 2015 07:48PM

The 'my projects menu' directory and the 'my virtual hosts' directory. Since both contain the same entry from the vhosts file, when I click it, it loads a tab in my browser which then loads up [bsm] but then redirects to my live site which is [xxxx.com].

Options: ReplyQuote
Re: Restoring backup to localhost but redirects to live site instead
Posted by: RiggsFolly (---.as43234.net)
Date: July 02, 2015 07:58PM

So this redirect happens when you click on a link or without yu doing anything?

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: Restoring backup to localhost but redirects to live site instead
Posted by: nickstarbright (---.ph.ph.cox.net)
Date: July 02, 2015 08:02PM

the redirect takes place when I click on the link in wamp or on the localhost page under your projects.

Options: ReplyQuote
Re: Restoring backup to localhost but redirects to live site instead
Posted by: RiggsFolly (---.as43234.net)
Date: July 02, 2015 08:16PM

I assume you are not being criptic about the actual name you have used in the ServerName parameter??

So try changing it like this

<VirtualHost *:80>
    DocumentRoot "c:/wamp/www/bsm"
    ServerName bsm.dev
    <Directory "c:/wamp/www/bsm">
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

And change the hosts file to

127.0.0.1 localhost
127.0.0.1 joomla1
127.0.0.1 bsm.dev

::1 localhost
::1 joomla1
::1 bsm.dev

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: Restoring backup to localhost but redirects to live site instead
Posted by: nickstarbright (---.ph.ph.cox.net)
Date: July 02, 2015 08:24PM

Okay, i tried that. I did receive a different result meaning that it directed to a different website this time.

Options: ReplyQuote
Re: Restoring backup to localhost but redirects to live site instead
Posted by: RiggsFolly (---.as43234.net)
Date: July 02, 2015 09:06PM

This sort of issue rings a bell, but I cannot quite remember why.

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: Restoring backup to localhost but redirects to live site instead
Posted by: nickstarbright (---.ph.ph.cox.net)
Date: July 03, 2015 05:13AM

Yes this is very strange. I can install a new installation of joomla, no problem.

But when I try to restore the akeeba back up to my localhost, no go. I just don't understand why it keeps redirecting.

Options: ReplyQuote
Re: Restoring backup to localhost but redirects to live site instead
Posted by: Otomatic (Moderator)
Date: July 03, 2015 10:03AM

Hi,

> ut when I try to restore the akeeba back up to my localhost, no go. I just don't understand why it keeps redirecting.

If you make a backup of your actual website with Akeeba and allow you to restore later, still on your actual site, there will be no problems.
But if you restore a local site, there may be problems.
There may be a configuration file has a absolute URL value and not relative or using $_SERVER['DOCUMENT_ROOT'].
I do not know if Akeeba backup and restores the database, but if it does, it can also be an absolute url in the database values.

Before launching the local site, you can clear the wamp/logs/access.log file then launch the local site then read the log file to see from when the url link to the actual site.
With Firefox, you may use the extension Leave HTTP Headers

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: Restoring backup to localhost but redirects to live site instead
Posted by: nickstarbright (---.ph.ph.cox.net)
Date: July 10, 2015 01:22PM

Thank you all for getting back to me and trying to help me with this matter. I have solved the issue.

For future reference in case anyone else runs into this problem. I had two .htaccess files, one as a backup which had a redirect directive located in it. I didn't create it, my hosting provider did. I was working in the wrong one which was my back up. Doh! :-[

Once the directive was deleted, presto! It worked!! grinning smiley

No more redirection. It just loads my joomla install on my localhost.

Again, thank you all for your assistance!

Options: ReplyQuote


Sorry, only registered users may post in this forum.