Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CodeIgniter Localhost redirecting to xampp homescreen

When I run CI project in the browser, using localhost/hr, it redirects me to localhost/dashboard/.

Searched different solutions but didn't get it working. here is my .htaccess file in "htdocs/hr" folder

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

Note: There is no .htaccess file in htdocs folder.

When i remove/rename index.php file and access to htdocs it gives me 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. 

What am i doing wrong, how to get it working?

Screenshot of my htdocs/hr folder is bellow

enter image description here

like image 489
Noman Ali Avatar asked Jan 02 '17 12:01

Noman Ali


1 Answers

You need to set RewriteBase in your .htaccess file in your folder, which is in your case ci.

So you would currently have

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

You should change it to

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /ci/

And that's it. It will work now.

like image 59
shazyriver Avatar answered Sep 19 '22 12:09

shazyriver