I set my baseurl
to:
http://localhost/codeigniter/
in the application/config/config.php file
as asked by the installation instructions.
I was following this tutorial. However, when I type in the url: http://localhost/codeigniter/index.php/pages/view
, I get the the following error:
Object not found!
The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.
If you think this is a server error, please contact the webmaster.
Error 404
localhost 7/27/2012 11:14:39 PM Apache/2.2.12 (Win32) DAV/2 mod_ssl/2.2.12 OpenSSL/0.9.8k mod_autoindex_color PHP/5.3.0 mod_perl/2.0.4 Perl/v5.10.0
I found the following contents in .htaccess
file in the path of E:\WEB D\xampp\htdocs\CodeIgniter_2.1.2\application
:
Deny from all
I am totally new to the CodeIgniter framework. Can someone help me out?
Base URL should be absolute, including the protocol: $config['base_url'] = "http://".$_SERVER['SERVER_NAME']."/mysite/"; This configuration will work in both localhost and server.
php echo base_url(); This function returns the same thing as site_url() , without the indexPage being appended. Also like site_url() , you can supply segments as a string or an array.
base_url() is the URL of your CodeIgniter root or the location of the index. php file along with a trailing slash appended to the end of the URL. If the domain name is example.com and the website is using HTTPS as well as www. Further, the index.
Basically one can use site_url() while creating links for controllers whereas base_url() can be used where we need to create urls for the assets like loading a css or js file or some image .
Ok, well for anyone wondering the final solution to this was that the directories were not properly named. When creating a local server it is important to put the contents of the files in the correct folder.
So if you have http://localhost/codeigniter
then the directory should be setup as \path\to\webdirectory\root\codeigniter
or in this case: E:\WEBD\xampp\htdocs\codeigniter
try edit your .htaccess file became like this below, and put .htaccess file in your root application folder
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With