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?
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]
Make sure that your php errors are visible.
I had this issue as well when trying to set the base_url for Code Igniter when I was working off localhost. I had a look in the htaccess file, checked that mod_rewrite was switched on, tried altering the base_url but all failed.
The solution was to make sure that the environment was set to development in the main index.php file and to ensure that $config['log_threshold'] = 4; is set in config.php.
After that my php errors showed up. I'd forgotten to switch the development environment for the new website build.
Related
I've working on my web application under ubuntu server. I would like to override or hide my index.php. I'm trying to access html GET method Pls. help, how I can not identify my error. Thanks!
<.htaccess code>
RewriteEngine On
RewriteRule ^([^/]+)/? index.php?url=$1 [L,QSA]
From this - http://192.168.2.60/api/index.php?url=auth
To this - http://192.168.2.60/api/auth
<Error-msg:>
Not Found
The requested URL /api/auth was not found on this server.
Apache/2.4.18 (Ubuntu) Server at 192.168.2.60 Port 80
I've search for multiple possible answer to work on. This post help me to work my .htaccess. I just need to enable the override at /var/www/. Here is the link it might help you guys!
Enabling .htaccess file to rewrite path
Seen a couple of questions on this topic, and all seem to be .htaccess related - I've pasted mine below.
.htaccess (stored in the root web folder, above applications):
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond $1 !^(index\.php|assets|images|js|css|uploads|favicon.png)
RewriteCond %(REQUEST_FILENAME) !-f
RewriteCond %(REQUEST_FILENAME) !-d
RewriteRule ^(.*)$ ./index.php/$1 [L]
</IfModule>
CodeIgniter config:
$config['base_url'] = 'https://'.$_SERVER['HTTP_HOST'].'/';
$config['index_page'] = 'index.php';
$config['uri_protocol'] = 'REQUEST_URI';
SSL Cert installed correctly & tested fine. Also tested with base_url swapped to http, and vhost setup for Port 80. Wildcard cert also tested on a different subdomain without codeigniter, working as expected.
All pages returning with a 404 error. Apache access log shows incorrect endpoints being hit;
Apache error log:
[core:info] [pid 26683] [client x.x.x.x:53318] AH00128: File does not
exist: /var/www/mysite/Account/login
This is the incorrect endpoint - this should be hitting /Application/Account/login to load the Account controller. This is only occurring on the currrent Server setup (Ubuntu 16.04 on a standard LAMP stack).
However, if I were to set up vhosts to start from the Application folder, this would obviously cause me to lose .htaccess, assets, images, etc etc. Would anyone know why CI seems to be looking for controllers under the root directory?
Make sure you vhost is setup correctly. Typos have major consequences for virtual hosts and the completely wrong location path for the controller might indicate a vhost setup problem.
You can confirm that .htaccess is working, or not, by including index.php in your browser address, e.g.
example.com/index.php/account/login
If that works but it doesn't when you leave out index.php then either mod_rewrite is not "on" or your vhost is messed up.
Check your class name and class file name.
Class name start with uppercase like "Functions"
Class file name start lowercase like "functions"
Controller's name same as class name like "Home_Controller =>
Home_Controller.php"
When you include your library in the project, you should write in
lowercase letters. Like this;
Functions.php => $this->load->library("functions");
$this->functions->yourMethod();
I had developed a website using Codeigniter. It was working good in localhost. When i hosted it and clicked on links i get "Internal Server Error".
Also i'm not able to see .htaccess files. Please tell me what i'm missing.
Works perfectly
Localhost:
$config['base_url'] = 'http://localhost/site/';
Welcome
When clicked above link, it goes to below url and works perfectly
http://localhost/site/welcome/page
Hosted
Public Web Server (Error):
$config['base_url'] = 'http://www.mysite.com/';
Welcome
When clicked above link, it goes to below url and gives an error
http://mysite.com/welcome/page
If you have access to the Apache error logs check those for why you are getting the 'Internal Server Error.'
On a Linux server those are usually found in '/var/log/apache2/error.log.'
On a Windows server they can by default be found in something like 'C:\Program Files\Apache\logs.' Or you can find out the location by looking in the conf file or virtual hosts conf file if you use that.
try
Welcome
see docs http://ellislab.com/codeigniter/user-guide/helpers/url_helper.html
OR to hide index.php
add .htaccess file
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond $1 !^(index\.php)
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
I have been getting this error in Zend framework when i want to run the static content , The error is like
///Not Found
The requested URL /public/content/services was not found on this server.
Apache/2.2.20 (Ubuntu) Server at localhost Port 8090///
This is occuring when I try to access localhost:8090/content/services
Please give me a solution , thanks in advance :)
I Replaced "AllowOverride None " with "AllowOverride FileInfo " in httpd.conf file and it worked !!!
make sure you create the route in your application.ini as specified on page 39 "Defining Custom Routes"
//this needs to be exact
resources.router.routes.static-content.route = /content/:page
resources.router.routes.static-content.defaults.module = default
resources.router.routes.static-content.defaults.controller = static-content
resources.router.routes.static-content.defaults.action = display
without the route being defined correctly the static content will not work as suggested by this book.
i/f you are going to use this book "Zend Framework: A Beginner’s Guide" follow the code as close as you can until you understand it. ZF1 is not trivial to understand.
Don't change your .htaccess arbitrarily, keep it as close to stock as possible. It's ok to use it to set the environment and that's about it. Zf1 won't work correctly if the .htaccess is even a little incorrect.
//stock .htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
I noticed you are using Ubuntu... Make sure you have the correct permissions and ownership of the files in your document root. Ubuntu has some different default settings for file permissions.
The book also instructs you to establish a vhost for your site ( page 13 "Define Virtual Host Settings" ). Please execute this recommendation it will make your life easier as you learn this framework.
I want to process all incoming requests through a single script (index.php in web-root).
So, the following is what currently happens: http://localhost/foo/bar/baz
Is routed by Apache (through .htaccess) to: http://localhost/index.php?url=foo/bar/baz
This works well, however, in Firefox I am able to do this: http://localhost/foo\ -> notice the backslash.
And Apache, instead of doing: /index.php?url=foo\
Emits a generic error page saying:
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 Apache/2.2.14
(Win32) DAV/2 mod_ssl/2.2.14
OpenSSL/0.9.8l mod_autoindex_color
PHP/5.3.1 mod_apreq2-20090110/2.7.1
mod_perl/2.0.4 Perl/v5.10.1
Directly going to: http://localhost/index.php?url=foo\ works without issues, however.
All the sites that I've seen on the internet seem to be able to handle backslashes gracefully (e.g., http://stackoverflow.com/tags/php\\\\\).
I consider this behavior a bug and I want to force Apache to forward backslashes correctly.
Here's my .htaccess file in its entirety:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [L]
How can I make this work properly?
Edit: I just tried this on my webhost and this is handled properly by them. Makes me think it's some setting in httpd.conf.
Probably need AcceptPathInfo off to not get those tolerated as forward slashes.
I was just having this issue on WampServer on Windows. This page had the solution - the AllowEncodedSlashes option that RobertPitt mentions above is the correct one, but it must go in the http.conf file, inside a VirtualHost block, eg:
<VirtualHost *:80>
AllowEncodedSlashes On
</VirtualHost>
It doesn't work in a .htaccess file.