Reputation: 89
I deploy the project in my regular routine but this time while deploying at aws facing some errors. I deployed there using the ssh command and a key pair at ubuntu 16.04. I installed lamp, PHP, and PHPMyAdmin there successfully.
This is the link and error I am facing http://52.60.197.219/api/category, it says error 404 not found I tried almost all solutions available but no luck.
Suggestions will be highly appreciated.
my.htaccess file ` Options -MultiViews
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ Api_load.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
`
my index.php file named as Api_load.php $app = require __DIR__.'/api/bootstrap/app.php';
$app->run();
structure of a deployed application API(folder contains all files and codes) .htaccess, Api_load.php
Upvotes: 1
Views: 562
Reputation: 160
yes , its a common error. its all because of conflicting .htaccess file. Follow these steps. 1)Create Zip of your folder and unzip into the directory you are going to deploy your code. 2)Edit you .env file according to your requirements i.e changing Db username,password and database name. 3).htaccess file and index file in public folder, bring them to the outside of the root directory. 4)now access your baseUrl/endpoint name. it will work.
Upvotes: 1
Reputation: 21
Try to solve your problem by adding the config below to /etc/apache2/apache2.conf
or site-avaliable/000-default.conf
, then restart apache2.
<Directory /home/away/workspace/park/public>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Upvotes: 1