How to change base_url() path from localhost to hosted site? - codeigniter

I have hosted CodeIgniter project in hostgator. In localhost project was working fine and I took that project and hosted in my domain and there I have set
base_url like this:
$config['base_url'] = 'http://mywebsite.com/';
But it is not working in server.

go to your config.php file and set your base_url there and make sure your model first letter is capitalized and dont forget to autoload your model or manually load it. if still not working try the link below
try this link and see if this would help you.

Related

move codeigniter project from localhost to live server

Trying to move the codeigniter project from laptop server to live server. Uploaded the files in Public_HTML and I modified the config.php, base_url, .htaccess as needed and also upgrade the Database... when i run project default controller called correctly when other controller can not call this message show 404 Page Not Found. config.php and .htaccess files update as correct information. This same project run successfully on Local or Desktop server but produce Error on live server 404 Page Not Found home controller (default controller) call but other controller not call.
What is your server? And whats your configuration file?
Make sure you enable mod rewite if you are using apache
a2enmod rewrite
Have you removed index.php from url? Try to access another controller like this.
<domain>/index.php/<controllername>

How to set up Dreamweaver to use CodeIgniter?

I am using dreamweaver cs5 and xampp. I created a folder name CI in htdoc, where all my codeigniter files and folders are , i.e application, system , user_guide, license.txt, index.php and .htaccess(which is blank).
My dreamweaver set up is :
Site
Site Name: codeIgniter Local Site Folder: C:\xampp\htdocs\CI
Servers
ServerName: codeIgniter Connect using: Local/Network
Server Folder: c:\xampp\htdocs\CI\ Web URL: http://localhost/site/
and i unticked remote server and ticked testing server.
My codeigniter set up is:
$config['base_url'] = 'http://localhost/site/';
$autoload['libraries'] = array('database');
and created site.php in the controller.
Error i am getting in dreamweaver is :
Dynamically-related files could not be resolved because the site defination is not
correct for this server.Retry|Setup.
Also when i am trying to view it as Live View or in browser it is taking me to
localhost/site/application/controllers/site.php , which saying object not found
But everything is fine using notepad++ though and i can see nothing is wrong in setting up codeigniter
Your weburl must match your site root, change your weburl and $config['base_url'] to http://localhost/CI/ and also check that your server model is set to php/mysql.

How can I get an old codeigniter project to work in a subdirectory

First off, I'm not a codeigniter developer, though I've had some exposure to it and MVC in general. I inherited a project where the companies old dev had taken down their codeigniter website and replaced it with a static one page html thing. They did this by (as far as I can tell) just renaming the index.php and putting an index.html in the root.
So... I moved all the codeigniter files to a subdirectory, and renamed the index.php file appropriately
Now the homepage appears, but all internal links are broken with an internal (500) server error.
I've done a couple things to no avail:
modified the config.php base_url to include the subdir: $config['base_url'] = "http://". $_SERVER['HTTP_HOST']."/subdir/";
tried all the options for $config['uri_protocol']
Anyone have any ideas? I really just need to recover the data from the site, which I can do manually just by looking in the database and some other stuff coded directly into the views - but I'd rather just get the old site running in the subdirectory.
Is $config['index_page'] = ''; ?
Is the server running Apache? If so, what about the .htaccess rules? If so, you may need to add a RewriteBase rule, like so:
RewriteBase /subdir/
We're going off the assumption that the old dev used anchor(), base_url(), and/or site_url() correctly. If they hard-coded the links (which you shouldn't do with CI), then you'd have to write .htaccess rules to rewrite them to the new sub directory or edit the controllers/views that might be generating such links.

how to transfer codeigniter site from localhost to live server

I developed a site in codeigniter with basic functionality now i want to update this site to my live server. But when i uploaded my site to live server it shows 404 - PAGE NOT FOUND.
http://www.nawtist.com/test/ams/
Please tell me what do i need to do. I searched a lot about this but i didn't found any helpful information. So is there any base_url or anything else that i need to change before upload this on live server really appreciate
And remember, many servers are case-sensitive and with CodeIgniter v3 you should change the controller's first letter file and model's first letter file to upper case. That worked for me too.
Best
You have problem with your htaccess file or mod_rewrite is disable on that server.
When you go to page with index.php it works (although css file doesn't work because of bad routing)
also check if $config['index_page']=''; if it should work without index.php
I had the same problem times ago and there are 4 points in codeigniter to care about as I remember:
Check base_url value in your "config.php"
Check database settings in "database.php"
Check .htaccess file contents if you have defined it once
Check routes.php if you have defined any custom routes
That's all!
If you are facing 404 page not found in Codeigniter after upload file local to live server then follow these steps
change your controller and file name first letter capital
same change as above in model class and file name i.e first letter capital
After following steps above your problem can be solve Thank you.

Codeigniter in shared ssl

I am not able to get codeigniter to work on my shared ssl url.
for example, on
https://nimrod.eukhosting.net/~nadavwei/myatar.co.cc/aaa
i get a 404 error
aaa is just a demo controller that should echo test
only the homepage - with no controller in the url - works
https://nimrod.eukhosting.net/~nadavwei/myatar.co.cc/
btw, i am using .htaccess
thanks
It looks like your provider is disabling .htaccess for the https server.
I am able to see your website here: https://nimrod.eukhosting.net/~nadavwei/myatar.co.cc/index.php/categories/26
But it won't work here: https://nimrod.eukhosting.net/~nadavwei/myatar.co.cc/categories/26
My guess is that their setup allows or disallows .htaccess based on the virtual domain, and since you are not using your virtual domain, it is being disabled. You should contact your hosting provider and see if they know or can provide more information.
You can also double check your .htaccess file, in case there is something about it specifying the virtual domain.
Also, as an FYI, you are going to have to modify your CodeIgniter configuration so that it dynamically the full path and turns on or off the index.php part of your URL based on whether or not the user is arriving via HTTPS:
$is_https = !empty($_SERVER['HTTPS']);
$config['base_url'] = $is_https ?
'https://nimrod.eukhosting.net/~nadavwei/myatar.co.cc/' :
'http://myatar.co.cc/';
$config['index_page'] = $is_https ? 'index.php' : '';
This should toggle the modes as necessary.

Resources