Created
February 26, 2021 04:48
-
-
Save MuhammadSaim/36173d8ae1368a5317d285b244ac0502 to your computer and use it in GitHub Desktop.
Deploy Laravel to Cpanel and redirect to public folder with .htaccess. Simple rename the server.php => index.php and create new file .htaccess in the root folder and this code in the .htaccess file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Options -MultiViews -Indexes | |
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] | |
# Handle Front Controller... | |
RewriteCond %{REQUEST_URI} !(\.css|\.js|\.png|\.jpg|\.gif|robots\.txt)$ [NC] | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteRule ^ index.php [L] | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_URI} !^/public/ | |
RewriteRule ^(css|js|images)/(.*)$ public/$1/$2 [L,NC] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment