In your Codeigniter project, you are getting the error “requested URL not found on this server error”, it means that the htaccess file is missing from the root directory of your Codeigniter application or misconfigured with xampp wampp ubuntu windows.
Here are two solutions to fix Codeigniter The requested URL was not found on this server error:
Solution 1: Verify .htaccess in public directory
Go to the public directory of the CodeIgniter app and verify if the .htaccess
file exists in the public directory. Or if .htaccess
file does not exist then you use solution 2.
If there is a .htaccess file present, then copy the Index.php and .htaccess file and paste both into the root directory of the CodeIgniter project.
And now go to /app/Config/
of the Codeigniter app and open the app.php
file, after this, you will need to change baseURL in this file, something like this:
public $baseURL = 'http://localhost:8080';
To
public $baseURL = 'http://localhost/your_project_name/';
Solution 2: Create a new .htaccess file
In this solution, you need to create .htaccess
file in the root directory, if it is not present in the CodingGitter app.
Once you have created the .htaccess
file, add the following code to it; Something like this:
Options +FollowSymlinks -IndexesRewriteEngine on
DirectoryIndex index.php
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
Now, you can open your browser and check that your error is fixed.
Conclusion
That’s it; you have learned how to fix the requested url was not found on this server. in codeigniter xampp/wamp on ubuntu windows.