I am creating a PHP Peaceful server to have an API in your area on my small mac.

I have handled make it possible for mod_rewrite and also have Overrides permitted for that site directory (~/Sites/api).

In ~/Sites/api may be the .htaccess file and index.php. Let me rewrite all demands to http://localhost/~myusername/api/* to index.php. I have to preserve the query parameters, but that is it.

I have attempted the next within the .htaccess file:

Options +FollowSymLinks
RewriteEngine On
RewriteRule (.*) index.php [QSA,NC,L]

This provides a 500:Internal Server Error.

Leaving comments the FollowSymLinks line provides a 403:Forbidden error.

I'm able to access index.php fine with no rewrites in position.

Any assist you to could offer could be much appreciated. I seem like weeping right now.

Thanks, Ross

RewriteRule ^api/(.*)$ index.php?handler=$1 [L,QSA]

In which the handler is exactly what is passed for your index.php script. For example, a request


could be rewritten to


However , [L] means stop spinning this URL, but you are producing a brand new URL with index.php, which is rewritten too, leading to infinite loop.

Add RewriteCond that excludes index.php from being rewritten.