无法通过IP/~account及临时URL访问网站,提示‘Not Supported’(Laravel)
Hey there, let’s tackle this frustrating "Not Supported" issue step by step—even though you’ve already configured index.php and .env, there are usually server or file structure gaps causing this. Here’s what to check:
Verify your Laravel file structure is set up correctly
Most hosts expect your site’s root directory to point directly to Laravel’spublicfolder, not the entire project root. If you uploaded the full Laravel project to~/public_html(or your host’s user directory root), the server can’t find the proper entry point.
Fix this by moving all files inside the Laravelpublicfolder to your host’s web root (e.g.,~/public_html), then update the paths inindex.phpto point to the rest of the Laravel files:// In your web root's index.php, adjust these lines to point up one level require __DIR__.'/../vendor/autoload.php'; $app = require_once __DIR__.'/../bootstrap/app.php';Check if user directory PHP execution is enabled
Many shared hosts disable PHP execution in/~accountpaths by default. Confirm with your host that:- The
mod_userdirApache module is enabled - The server configuration allows
.htaccessoverrides in user directories (look for<Directory /home/*/public_html>withAllowOverride Allset)
- The
Validate temporary URL mapping
Temporary URLs from hosts often map to a specific temporary directory. Make sure this directory is pointed to Laravel’spublicfolder, not the project root. Also, double-check that the temporary URL has PHP support enabled, and that your server’s PHP version meets your Laravel version’s requirements (e.g., Laravel 10+ needs PHP 8.1+).Fix .htaccess issues
Laravel’spublicfolder relies on.htaccessfor URL rewriting. If this file is missing or misconfigured, you’ll get errors. Use Laravel’s default.htaccessfor Apache:<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] </IfModule>If you’re on Nginx, ensure your server block includes this location rule:
location / { try_files $uri $uri/ /index.php?$query_string; }Set proper file permissions
Laravel needs write access to thestorageandbootstrap/cachedirectories. Run these commands (adjust the user/group to match your server’s setup, e.g.,apache:apacheornginx:nginx):chmod -R 755 storage bootstrap/cache chown -R www-data:www-data storage bootstrap/cacheCheck server error logs
The fastest way to pinpoint the issue is to look at your server’s error logs (Apache’serror.logor Nginx’serror.log). They’ll show specific details like missing modules, path errors, or permission issues that aren’t visible on the frontend.
内容的提问来源于stack exchange,提问作者Gregory Sykes

