Welcome Guest, Not a member yet? Register   Sign In
OSX 10.6.8 Snow Leopard - removing index.php from URL via userdir
#1

[eluser]Unknown[/eluser]
I had a fair bit of trouble with this... (not alone I gather) and from what I've found on this forum, SO & Google nothing really matched my issue.

So in altruistic fashion, here's what worked for me:

Background: Mac OSX 10.6.8. Default, vanilla PHP install using userdirs (i.e. localhost/~username) NOT MAMP

Edit /etc/apache2/users/[your_username].conf - for me, by default, AllowOverride was set to None. This will ignore any .htaccess files. You can set it to all but FileInfo will suffice for redirects, Limit for host access. See here for further details on allow override
Code:
<Directory "/Users/[your_username]/Sites/">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride FileInfo Limit
    Order allow,deny
    Allow from all
</Directory>
I found I had to add FollowSymLinks also or you'll get a 403 Forbidden
You could change the /etc/apache2/httpd.conf if you want, but that'll make it global.
Restart Apache:
Code:
sudo apachectl restart
Add the following .htaccess file to your CI root dir (~[your_username]/Sites/ci_root_dir)
Code:
RewriteEngine on
RewriteBase /~[your_username]/ci_root_dir
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

Don't forget to change config/config.php to blank
Code:
$config['index_page'] ='';

And you should be good to go.

If you still have trouble check the apache2 error_log (use Console) to see what's going on. That's what pointed me in the right direction with a bit of trial and error. The RewriteBase directive was key...

I'm currently developing a RESTful API using Phil Sturgeons lib (good work Phil) and the redirects work just as well.

Carry on.




Theme © iAndrew 2016 - Forum software by © MyBB