I've searched the site thoroughly and Googled for this as well, but to no avail.
I use Apache2 + PHP on my Mac OS X.
I haven't changed much of the configuration on any of them, just enough to get everything working correctly.
Here's my .htaccess
file:
<IfModule mod_rewrite.c>
Options +FollowSymLinks
Options +Indexes
RewriteBase /~milad/mysite/
RewriteEngine On
RewriteRule ^$ index.php?:url [L,QSA] #Handling tail with no parameters
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*?)$ index.php?:url=$1 [L,QSA]
</IfModule>
This works just fine for all the files located at http://localhost/~milad/mysite/*
.
But I want to make my .htaccess
file independent of my installation's particulars, i.e., I don't want to have to include the RewriteBase ...
line in my code.
But when I remove that line, Apache tries to map it to a URL which I don't understand. What I get is:
Not Found
The requested URL /Users/milad/Sites/newave/index.php was not found on this server.
which is just ridiculous, because the index.php
file is JUST where that URI is pointing to.
Anyway, when I try to rewrite to /index.php
instead of index.php
, I find that it is being rewritten to http://localhost/index.php
. So how is it that I can't use just the relative path, or just use ./index.php
(Yes, I've tried that, too).
Any insight would be greatly appreciated.