Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

chris J's avatar

Upload project with sanctum api

Hello guys, I have just uploaded my website which is built with laravel 8 and sanctum. The sanctum routes return a 404 error even though they exist. I have tried changing the stateful domain of sanctum file located in Config folder but still gives me a 404 error. Also everything is correct in .env file. Should I change something else in order to work?

0 likes
2 replies
Snapey's avatar

make sure the public folder is the document root and that you have deployed .htaccess file

chris J's avatar

Sorry for the late response. Inside my public_html folder which is the document root I have an htaccess file which contains: <IfModule mod_rewrite.c> <IfModule mod_negotiation.c> Options -MultiViews -Indexes </IfModule>

RewriteEngine On

# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]

# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

#API
RewriteRule ^api/(.*) myproject/routes/api.php/ [L]

But it still shows 404 error while trying to access api routes

Please or to participate in this conversation.