Apache2 htaccess api directory not working but web application is

Keywords: General - AWS - How to - Other
Description:
This is my directory

-main folder
–front-end folder
—dist
----project-folder
–api folder

my htaccess file is set up this way:

<VirtualHost *:80> ServerName app.stage.project.com
DocumentRoot "/opt/bitnami/apache2/htdocs/app.stage.project.com/front-end-folder/dist/project-folder"


<Directory "/opt/bitnami/apache2/htdocs/app.stage.project.com/front-end-folder/dist/project-folder">
 Options -Indexes +FollowSymLinks
 AllowOverride All
 Require all granted
</Directory>

<Directory "/opt/bitnami/apache2/htdocs/app.stage.project.com/front-end-folder/dist/project-folder/api">
Allow from none
Deny from all
</Directory>

<Directory "/opt/bitnami/apache2/htdocs/app.stage.project.com/front-end-folder/dist/project-folder/api/public">
Allow from all
</Directory>

# Bitnami applications installed with a prefix URL (default)
Include "/opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf"
</VirtualHost>

This is my directory

main folder
front-end folder
dist
project-folder
api folder
my htaccess file is set up this way:

<VirtualHost *:80> ServerName app.stage.project.com
DocumentRoot “/opt/bitnami/apache2/htdocs/app.stage.project.com/front-end-folder/dist/project-folder”

<Directory “/opt/bitnami/apache2/htdocs/app.stage.project.com/front-end-folder/dist/project-folder”>
Options -Indexes +FollowSymLinks
AllowOverride All
Require all granted

<Directory “/opt/bitnami/apache2/htdocs/app.stage.project.com/front-end-folder/dist/project-folder/api”>
Allow from none
Deny from all

<Directory “/opt/bitnami/apache2/htdocs/app.stage.project.com/front-end-folder/dist/project-folder/api/public”>
Allow from all

Bitnami applications installed with a prefix URL (default)

Include “/opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf”

I created a symlink in my dist file to my api folder which is a couple of directories above.

The issue I have is that my front end works, but the api routes do not. They keep returning the index.html file…

Not sure what to do… Any thoughts?

Sorry directory is:

  • main folder
    ** front-end folder
    *** dist
    **** project-folder
    ** api folder

Hi @oflores2313,

Can you check the following guide for setting up a custom PHP application on LAMP:

https://docs.bitnami.com/aws/infrastructure/lamp/administration/create-custom-application-php/

Regards,
Michiel

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.