Server Fault Asked by spm on February 24, 2021
I recently moved a webapp, built using Laravel, to a rackspace cloud server.
The homepage resolves just fine as I have the root set in the apache config.
However, when a request is made to any of the routes, the server attempts to look for an actual file with the name of the route. For example:
If I request
www.mywebapp.com/login
The server error log shows
File Does Not Exist: /var/www/html/public/login
Part of my apache config
<Directory/>
Options FollowSymLinks
AllowOverride None
</Directory>
And my .htaccess which is located in the public folder
# Apache configuration file
# http://httpd.apache.org/docs/2.2/mod/quickreference.html
# Note: ".htaccess" files are an overhead for each request. This logic should
# be placed in your Apache config whenever possible.
# http://httpd.apache.org/docs/2.2/howto/htaccess.html
# Turning on the rewrite engine is necessary for the following rules and
# features. "+FollowSymLinks" must be enabled for this to work symbolically.
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
</IfModule>
# For all files not found in the file system, reroute the request to the
# "index.php" front controller, keeping the query string intact
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
This is my first web app so I am very new to all of these concepts and have no formal training. Constructive criticism please. All help is greatly appreciated.
Edit 1: .htaccess file corrected
Your issue is the first set of rewrites, namely:
RewriteCond %{REQUEST_URI} !public/
The easy fix is to just move everything to the "public" folder instead of /var/www/html
. The other fix would be to remove that rewrite unless you actually needed it for something.
Answered by Nathan C on February 24, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP