![]() |
Using base_url() on my new host. - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Using base_url() on my new host. (/showthread.php?tid=32428) Pages:
1
2
|
Using base_url() on my new host. - El Forum - 07-22-2010 [eluser]Xarren[/eluser] I'm just attempting to migrate my project onto a live host. One problem I have is that any use of base_url() function returns "http://localhost/". Now that's not exactly helpful when I'm trying to reference my files and other web pages. Any tips on how to get it to work? I'm sincerely confused, this is the first time I'm hosting a codeigniter website up, and it just refuses to work for me. Using base_url() on my new host. - El Forum - 07-22-2010 [eluser]pbreit[/eluser] Check your config.php: $config['base_url'] = BASE_URL; Using base_url() on my new host. - El Forum - 07-22-2010 [eluser]Xarren[/eluser] Ahh thank you, that fixes that issue, however now I am left with "http://www.discreetdelights.co.uk/css/admin_style.css" as my css link, which does not work. How do I need to reference to a file on my remote host? The actual location of that file is "home/discreet/public_html/discreetdelights.co.uk/admin/css/admin_style.css". Please bare with me, it is the first time I'm doing this. Using base_url() on my new host. - El Forum - 07-22-2010 [eluser]pickupman[/eluser] It depends on where you have CI installed. It is best to reference your assets(js/css) using absolute url's. You would use something like: Code: <link rel="stylesheet" type="text/css" href="/admin/css/admin_style.css" /> Putting a / in the front of the path says always add domain name(discreetdelights.co.uk) to the front of the url. This will work both on localhost and server. Using base_url() on my new host. - El Forum - 07-22-2010 [eluser]Xarren[/eluser] That still doesn't work. I'm a bit confused on how to access that file from that host. my folder structure is as follows i have public_html which contains system, index.php, admin.php and discreetdelights.co.uk system has the CI installation and discreetdelights.co.uk has admin and public Could you please help me make some sense out of this, the difference between the servers path and the access url path is confusing me. Using base_url() on my new host. - El Forum - 07-22-2010 [eluser]pickupman[/eluser] It's not working because of your .htaccess file I am guessing Both http://discreetdelights.co.uk/css/admin_style.css http://discreetdelights.co.uk/admin/css/admin_style.css Return a CI 404 error. You won't be able to make the <link> tag yet. You should be able to type in the exact web address of the stylesheet in your browser and have it open up. Could you post the .htaccess file you have in /home/discreet/public_html/discreetdelights.co.uk/? Using base_url() on my new host. - El Forum - 07-22-2010 [eluser]Xarren[/eluser] Thank you for all your attention, I hate how a fullblown project which worked perfectly on my localhost got ripped to pieces, and Im up at 2am trying to fix it. fml. Code: RewriteEngine On Using base_url() on my new host. - El Forum - 07-22-2010 [eluser]Xarren[/eluser] Ahh that makes sense.. I need to add bits for admin.php aswell, let me try that. edit: Im not 100% confident with HTACCESS, could you please help me make one that will work using both my index files, public.php and admin.php? I only just seperated the website into those two parts, and forgot to edit my HTACCESS. Using base_url() on my new host. - El Forum - 07-22-2010 [eluser]pickupman[/eluser] Are you running multiple domains from the same account? I know this is typically the folder structure when you create an addon domain through cPanel. Any particular reason for creating the 2 separate applications that need index.php and admin.php. Your description of your folder layout is confusing. Try like or take a capture: /public_html /application /system /index.php /public.php /admin.php /discreetdelights.co.uk /admin.php Maybe this would work Code: RewriteEngine On Or if all else fails, delete the .htaccess file, work out the file paths then add it back in. Remember .htaccess in subfolders take priority over its parent folders' .htaccess file. Using base_url() on my new host. - El Forum - 07-23-2010 [eluser]Xarren[/eluser] I separated it because of how different the admin and the public view sections are, I thought it would be easier to upkeep if there were in two different parts, however this is my first CI project, have you got any suggestions on how to organise it? Code: Internal Server Error thats trying to access admin with that HTACCESS. I will try to reorganise my files back into one application, and see if thats easier to work with. thank you for your help. |