Anshul Verma Anshul Verma - 18 days ago 5
PHP Question

php-Codeigniter url not found

I have a project inside /htdocs/trunk folder. Codeigniter folder structure such as 'application', 'system' etc exist inside trunk. Below is .htaccess file which is inside /htdocs/trunk/application:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

# Removes index.php from ExpressionEngine URLs
RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
RewriteCond %{REQUEST_URI} !/system/.* [NC]
RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]

# Directs all EE web requests through the site index file
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>


Below is my config.php:

$config['base_url'] = 'http://localhost/trunk/';
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';


When I open the base url above in the browser, I successfully get my login page. However, when I click on anchor link which calls the controller function, I get 403 Forbidden. Below is routes, view and error:-

routes.php

$route['default_controller'] = "chomecontroller";
$route['search'] = "csearchentrycontroller";
$route['search/(:any)'] = "csearchentrycontroller/$1";


view

<a href="<? echo base_url();?>search/searchEntry/4/1"> Redirect here </a>


error

You don't have permission to access /trunk/< on this server.


Any help would be highly appreciated. Thank you

Answer

I think so You would have skip the index.php in between the URL. Please include index.php in between URL and check whether its working or not.

Ex: http://localhost:90/codeigniter_captcha/index.php/{controller_name}.

After that if you want to skip index.php in between URL change it in Config File.