Sunday, January 2, 2022

[FIXED] Failed to access Symfony API routes and getting Symfony strating page

Issue

I've recently switched to mac and i'm trying to setup MAMP enivrement and a Symfony based API. The problem for now is that i can't access routes all i can get is the Symfony welcome page.

here is my httpd-vhosts.conf file:

<VirtualHost *:80>
    DocumentRoot /Applications/MAMP/htdocs
    ServerName localhost
</VirtualHost>

<VirtualHost *:80>
 DocumentRoot /Applications/MAMP/htdocs/syndico-api/public/
 ServerName syndico-api.local
 ServerAlias www.syndico-api.local
 DirectoryIndex /index.php
  <Directory /Applications/MAMP/htdocs/syndico-api>
    AllowOverride All
    Order Allow,Deny
    Allow from All
  </Directory>
</VirtualHost>

Thanks!


Solution

I just found that i needed to add an Alias in the httpd.config

Alias /api "/Applications/MAMP/htdocs/syndico-api/public/index.php"

i can get now to the api by adding /api to the local address.

thanks everyone!



Answered By - B. Mohammad

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.