Welcome Guest, Not a member yet? Register   Sign In
Problem with URI
#11

[eluser]MicroBoy[/eluser]
@summer Student:
I saw that in the config file it says like above:
Code:
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
#12

[eluser]menslow[/eluser]
Good catch MicroBoy. I'm still getting the same results though with:
Code:
$config['base_url']    = "http://localhost/michaelenslow2/";
#13

[eluser]TheFuzzy0ne[/eluser]
Try this htaccess file:
Code:
# Block directory listings
Options -Indexes

# Set directory index to index.php
DirectoryIndex index.php

# Rewrite base to work on all mayor operating systems
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

You may need to substitute the last line with:
Code:
RewriteRule ^(.*)$ index.php?/$1 [L]
#14

[eluser]menslow[/eluser]
Yeah... still no luck... do you think there's a problem with mod_rewrite?

~m
#15

[eluser]menslow[/eluser]
I think the problem has to do with mod_rewrite somehow...

I ran through this simple mod_rewrite example...
http://www.workingwith.me.uk/articles/sc...od_rewrite
... and it failed to rewrite the uri.

Using phpinfo(), I can see that mod_rewrite is one of the loaded modules so I'm not sure why it would be failing. Any ideas? I'm a total Apache noob.
#16

[eluser]jedd[/eluser]
Hi Michael,

Not OSX au fait .. so you will have to hunt the details down yourself, but I suggest you track the contents of the access and error logs for Apache. They might(!) be under /var/log/apache2 - but who knows where Steve put them.

In any case, those are the two files there that are of interest. I recommend you open up two separate command line terminals, you might need to sudo to get access to these two files, and run this command in one window:

Code:
$   tail   -f   /var/log/apache2/access.log

In the other window, run the same command but against 'error.log'. You'll have to find the right PATHs, as I say.

The -f parameter will follow the log files. So if you crank these up, and then use your web browser to hit the page again, you'll see exactly what Apache thinks it's being asked for, and more importantly what it can and can't deliver.
#17

[eluser]menslow[/eluser]
The access log is giving me:

"GET /michaelenslow2/services HTTP/1.1" 404 221

And Error log is:

File does not exist: /Users/michaelenslow/Sites/michaelenslow2/services


I'm not sure if this is telling me anything new though. It definitely seems to be isolated to mod_rewrite and not something I'm doing wrong in CI. I'll dig around with Apache documentation and post when I find the solution.

Thanks all for helping narrow things down.
#18

[eluser]jedd[/eluser]
It might be that you are not allowed to override such things.

This will be a configuration in the primary apache file(s) - which should be somewhere under /etc/apache2/ .. but, again, on OSX it's anyone's guess.

You'll be looking for a line that refers to www root or web root or similar. Hmm, perhaps it might refer to the Users directory structure, as OSX's Apache seems to have some concept of this. (Normally on *nix boxes you have a directory in your home, called public_html and that is where your personal web files are served from - this is directed via URL's like http://localhost/~michaelenslow/ as an example.)

I digress.

If there's a GUI front end to the Apache configuration, or you can edit it manually, look for a line that says something like 'AllowOverride None'. There may be several. You may need to read the preamble around the line(s) to get some context. In any case, change it to 'AllowOverride All'. You will need to restart apache (again, on your own there) to effect this change.
#19

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

Also check whether rewrite module is on in ur apache....
#20

[eluser]menslow[/eluser]
FIXED!! Alright... Thanks Jedd and Nevio for helping me narrow it down... Here's what I did in case others have the same problem...

It was an Apache config issue on Mac 10.5


1. I followed this user guide to remove "index.php" from my urls:
http://ellislab.com/codeigniter/user-gui.../urls.html

Very simple, but it didn't work for me.

2. I determined that it was a problem with Apache mod_rewrite and not CodeIgniter by trying this simple mod_rewrite test:
http://www.workingwith.me.uk/articles/sc...od_rewrite

This test failed on my workstation.

3. I verified Apache mod_rewrite was loaded - yes

4. With Jedd's help, I found these two blog posts to get mod_write to work on Mac 10.5:
http://www.deheus.net/petrik/blog/2005/0...-mac-os-x/
http://technotes.tumblr.com/post/3039574...-x-leopard

6. In my Apache user.conf file, I had to change:

Code:
AllowOverride No

to:

Code:
AllowOverride All AuthConfig


7. After this change I now saw a 403 Forbidden error... Progress! The error details were:

Code:
Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden:...


8. This lead me to this post:
http://www.elharo.com/blog/software-deve...-problems/

So I had to add:

Code:
Options +FollowSymLinks

... to the top of my .htaccess file.


9. And my file .htaccess file looks like this in order to get the paths to my .css files to work:


Code:
Options +FollowSymLinks

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]


Time to crack a beer! Thanks again guys for the help.




Theme © iAndrew 2016 - Forum software by © MyBB