Mod_rewrite for PHP RESTful Server

I am developing a PHP RESTful server for an API locally on my mac.

I managed to enable mod_rewrite and allow overrides for the site directory (~ / Sites / api).

In ~ / Sites / api - the .htaccess file and index.php. I would like to rewrite all http: // localhost / ~ myusername / api / * requests in index.php. I need to save request parameters, but this.

I tried the following in a .htaccess file:

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

This gives 500: Internal server error.

Commenting out a line FollowSymLinksgives 403: Forbidden error.

I can access index.php perfectly without overwriting.

Any help you could offer would be greatly appreciated. At the moment, I feel crying.

Thanks Ross

+3
2
+7

, [L] URL-, URL index.php, , .

RewriteCond, index.php.

+1

Source: https://habr.com/ru/post/1783635/


All Articles