tags:

views:

994

answers:

2

I've added this:

<VirtualHost *:8888>
    ServerName dietron
    DocumentRoot /Users/kieransenior/Development/reformsoft_dietron/trunk/var/www/dietron/htdocs

    <Directory /Users/kieransenior/Development/reformsoft_dietron/trunk/var/www/dietron/htdocs>
        AllowOverride All
        Options All
    </Directory>

    php_value include_path .:/Users/kieransenior/Development/reformsoft_dietron/trunk/var/www/dietron/include:/usr/local/lib/pear
    php_value magic_quotes_gpc off
    php_value register_globals off
</VirtualHost>

to my httpd.conf in the hope that my .htaccess file in the htdocs folder will be picked up with the following rules:

RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1

That is the entire contents. I'm renaming .htaccess on my MBP by doing mv i.htaccess .htaccess which I'm assuming is correct? I'm using MAMP therefore the httpd.conf has a load of default settings and I added the first snippet above at the very end of it. I'm then restarting it by stopping Apache and starting it again. The index.php gets picked up fine, however when I do http://localhost:8888/anythinghere it comes up with a 404, which shouldn't happen.

Any ideas on what I'm doing wrong?

EDIT: Here's my httpd.conf

EDIT: Here's the error in the Apache log:

[Fri Jun 05 16:02:22 2009] [error] [client ::1] File does not exist: /Users/kieransenior/Development/reformsoft_dietron/trunk/var/www/dietron/htdocs/testing
A: 

Ensure that your AllowOverride directive is set properly at a global level. If no override is allowed (AllowOverride None) at your webroot, then your htaccess file will be ignored.

Rob Wilkerson
I've provided a link to my actual httpd.conf located in Applications/MAMP/conf/Apache/
Kezzer
Your `NameVirtualHost` directive value needs to match your virtual host config:NameVirtualHost *:888<VirtualHost *:8888> ...</VirtualHost>See if that solves the whole problem.
Rob Wilkerson
Unfortunately that didn't work either. Perhaps I should actually install Apache and MySQL locally as opposed to using MAMP? That way I have more control over it.
Kezzer
For the purposes of config, if you have access to your httpd.conf, you have full access to Apache. I ended up using the MacPorts version, myself, but for other reasons. You already have full access to the configuration. I did notice a typo in my comment above, if you didn't catch it: NameVirtualHost *:8888 (4 8's, not 3).
Rob Wilkerson
+1  A: 

A couple of suggestions.

First, on line 461 of your httpd.conf:

AccessFileName afn.htaccess

Shouldn't that be .htaccess?

The second thing I see is that the server name is set:

ServerName dietron

but you're trying to access it with localhost

I'd suggest that you put an entry in your /etc/hosts file so that dietron resolves, either to your local ip address or your loopback (127.0.0.1), and then access the server with http://dietron:8888

chris
That's what I get for staring at httpd.conf all day. Thankyou sir.
Kezzer
Been there, done that - glad to help.
chris