Welcome Guest, Not a member yet? Register   Sign In
Yet another URI issue
#1

[eluser]Geoffrey[/eluser]
I've been looking at CI for a couple of days now and the potential looks great.

My problem is that I've tried to follow the documentation, wiki and various suggestions on the forum but I'm still getting Apache2 404 errors from some of my URIs.

Using the default CI (1.6.3) I've added a second function called test2 to the welcome.php file.

I also have the following in a .htaccess file
Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php?/$1 [L]

and in my routes.php file
Code:
$route['default_controller'] = "welcome";
$route['test2'] = "welcome/test2";

$route['scaffolding_trigger'] = "";

The uri_protocol is set to AUTO, the index_page is empty and the base_url is correct.

I've found I can only access the test2 function by including index.php in the url.

http://127.0.0.1/~geoffrey/test/index.php/test2
http://127.0.0.1/~geoffrey/test/index.php/welcome/test2

both work but...

http://127.0.0.1/~geoffrey/test/test2
http://127.0.0.1/~geoffrey/test/welcome/test2

both return apache 404 errors.
#2

[eluser]Adam Griffiths[/eluser]
Both will return 404 errors because Apache thinks you are accessing folders, not a URI in CodeIgniter. Try adding something like this in the .htaccess file.

Code:
RewriteEngine on
RewriteRule ^([^/\.]+)/?$ index.php/$1 [L]

I doubt that will work because I haven't tested it, but I'm sure you can tweak it to work.
#3

[eluser]Geoffrey[/eluser]
Well as I have access to the httpd.conf file, I deleted .htaccess and used the following alias

Code:
Alias /CI/  /Library/WebServer/Documents/CI/index.php/

Should've tried the easy option first I guess.




Theme © iAndrew 2016 - Forum software by © MyBB