CodeIgniter Forums
CodeIgniter problem after upload to hosting - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Installation & Setup (https://forum.codeigniter.com/forumdisplay.php?fid=9)
+--- Thread: CodeIgniter problem after upload to hosting (/showthread.php?tid=70419)



CodeIgniter problem after upload to hosting - Griwen - 04-06-2018

Hello! I have problem with CodeIgniter!

When i launch server on XAMPP everything is working good:
[Image: localhost.png]


The problem take place when I put the code to my hosting on nazwa.pl. When I press button "Submit Post!" I get my hosting company page, that my site is hosted on nazwa.pl servers:
[Image: zewnetrzny.png]

I don't know where is the problem, mayby in configuration? 

Thanks for help!


RE: CodeIgniter problem after upload to hosting - php_rocs - 04-06-2018

@Griwen,

That's were I would start. Maybe your base_url in your config file or maybe your action parameter in your form tag.


RE: CodeIgniter problem after upload to hosting - Griwen - 04-06-2018

@php_rocs

a have it in folder and now it's working but i don't know how, I added a line in .htacces:

RewriteBase /folderWithCI/

and in config:

$config['base_url'] = 'http://domain.pl/folderWithCI/';

Don't know why it's not working without that line in htaccess if i have subfolder declarated in baseurl


RE: CodeIgniter problem after upload to hosting - jreklund - 04-06-2018

If you do not declare a RewriteBase it will start looking for files at domain.pl, but you have your files in a folder (folderWithCI). So it give you an error message.

If you don't want a folder, specify: RewriteBase /


RE: CodeIgniter problem after upload to hosting - alamowais - 06-22-2018

Base URL should be absolute, including the protocol:
$config['base_url'] = "http://somesite.com/somedir/";
If using the URL helper, then base_url() will output the above string.

Passing arguments to base_url() or site_url() will result in the following (assuming $config['index_page'] = "index.php";:

echo base_url('assets/stylesheet.css'); // http://somesite.com/somedir/assets/stylesheet.css
echo site_url('mycontroller/mymethod'); // http://somesite.com/somedir/index.php/mycontroller/mymethod