• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with 2 local domains

#1
[eluser]Justin Question[/eluser]
Hello,
let me first say, that I like CodeIgniter very much. It's light, not hard to understand and almost properly working :-)

Now to my problem,
I developed a single site 'DomainA' and everything was runnning fine on my localhost with MAMP as server. Then I copied the domain folder including CodeIgniter to build a second site under htdocs/DomainB and set the base_url in config.php to 'DomainB'. I changed some pages to see the difference to DomainA.

So far, no problem, the browser shows the correct homepage of each domain.
When I click on a link of the homepage, the browser loads the next page from the domains folder.
But..
as soon as I click a second time on a DomainB page, it loads a page from DomainA. This is true for all links, the first time it loads correctly, the second time it switches to the other domain.

What is happening here? Thank you for helping.

#2
[eluser]jedd[/eluser]
Hi Justin and welcome to the CI forums.

Have you read through the section in the [url="/wiki/FAQ"]FAQ[/url] about moving from one host to another?

It's probably something like base_url or your .htaccess file.

grep is your friend in these situations.

#3
[eluser]BrianDHall[/eluser]
Also, make sure your VirtualHost Apache settings for your local domains are set correctly - that gets me everytime.

Also make sure the address in your toolbar stays on the right domain, as if suddenly a link startes pointing to the wrong domain then you've found your problem.

#4
[eluser]Justin Question[/eluser]
Hi jedd,

thank you for the quick reply.
Yes, I searched the forum and read the FAQs.
The problem is somewhat more funny. :-)

* I did not changed hosts, its the same local server.
* I did set base_url()
* I copied the complete folder including codeigniter and .htaccess

The funny thing, everything is working until the second click. Then the DomainB switches to DomainA.

Do you have any idea? Thank you

#5
[eluser]Justin Question[/eluser]
[quote author="BrianDHall" date="1261101341"]Also, make sure your VirtualHost Apache settings for your local domains are set correctly - that gets me everytime.

Also make sure the address in your toolbar stays on the right domain, as if suddenly a link startes pointing to the wrong domain then you've found your problem.[/quote]

Thank you for helping,
can you please give more information regarding 'VirtualHost Apache settings' ?
Actually I have this 'pointing to wrong domain' problem.
But what causes this?

#6
[eluser]Justin Question[/eluser]
Please stop helping me :-)

I have found the issue:
If someone has the same problem, then:
Dont just copy the .htaccess, if there is a hardcoded RewriteRule.

Everythings fne again, thank you all!

#7
[eluser]jedd[/eluser]
[quote author="Justin Question" date="1261103724"]
Dont just copy the .htaccess, if there is a hardcoded RewriteRule.
[/quote]

From the [url="/wiki/FAQ"]FAQ[/url]:
Quote:Please note that you should have done ALL of the following easy steps before posting to the forums:
o use phpinfo.php and confirm mod_rewrite is available
o cycled through the $config[‘uri_protocol’] options - trying ALL of the FIVE choices there
o checked / changed your .htaccess for host-specific paths

[quote author="jedd" date="1261100068"]
It's probably something like base_url or your .htaccess file.
[/quote]

#8
[eluser]Justin Question[/eluser]
The best is, I did that hardcode myself PFF! :red:


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.