Question

I'm working on a ubuntu server that installed by me. I have made a php web application using codeigniter frame work. most of the things working very well. but the thing is I can't use ulr like this

<a href="<?php echo base_url().'new_user'; ?>" >New User</a>

it is redirect me to an error page saying

The requested URL /sdbl/new_user was not found on this server.

my route.php file is looking something like this.

$route['new_user'] = "new_user/controller_new_user";

but when i type full url in the href="" like

<a href="index.php/new_user/controller_new_user" >New User</a>

This is working well.

i tried doing thousands things like editnig htacces file and so many. nothing works for me.

Was it helpful?

Solution

According to the CodeIgniter documentation, you should use an .htaccess file to remove the "index.php" from the URL, here's an example file :

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top