Welcome Guest, Not a member yet? Register   Sign In
trouble with my controllers (basic stuff)
#1

[eluser]nemanjanq[/eluser]
Hi,

I have problem, with my controllers routing.

I have setup this:

config.php
Code:
$config['base_url']    = "http://localhost/project/";
$config['index_page'] = "index.php";

routes.php

Code:
$route['default_controller'] = "home";

and now ...

when I type in

http://localhost/project/ - WORKING goes to my home controller
http://localhost/project/home - NOT WORKING ?
http://localhost/project/home/index - NOT WORKING ?
http://localhost/project/admin/ - NOT WORKING ? (I have admin controller)

if I add index.php in links like

http://localhost/stampar_dev/index.php/home/index - WORKING.

I tryed http://ellislab.com/codeigniter/user-gui.../urls.html to

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

when I do this all my links go back to http://localhost/ etc. my WAMP starting page.

help. Smile
#2

[eluser]Dam1an[/eluser]
You're making the rewrite to an absolute path (just the / so it started from the web root)
change it to be
Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ ./index.php/$1 [L]

It should then do the rewrite relative to the directory it's in (same as index.php)
#3

[eluser]nemanjanq[/eluser]
Thanks! That little dot changed a lot. Smile

Now I have new problem. My css is not loading right.

I have this in my views
Code:
<link type="text/css" rel="stylesheet" href="<?=base_url();?>assets/css/admin.css" />

and I get this out
Code:
<link type="text/css" rel="stylesheet" href="http://localhost/project/assets/css/admin.css" />

which looks fine assets is in my root folder, but when I click on
Code:
<link type="text/css" rel="stylesheet" href="http://localhost/project/assets/css/admin.css" />

I got 404 ?
#4

[eluser]nemanjanq[/eluser]
damm, ... I just add assets, and it works. I need to learn more about .htaccess Smile

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




Theme © iAndrew 2016 - Forum software by © MyBB