httpd.conf virtual host not working
Question
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
Solution
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
OTHER TIPS
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.