I cannot start my laravel project on cpanel server. Asked domain provider website to add the pyp version that my laravel project use but still have that problem. I need to solve this is 4 hours please help.
Here is my .htaccess
”’
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]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
”’
2
Answers
If you’re using cPanel on shared hosting, try the following assuming the root of your project is
public_html
(you can adjust the path if your project is in another directory withinpublic_html
):/public_html
.htaccess
file in the root of the project that looks like:This will direct requests to the public folder.
.htaccess
file in thepublic
directory that looks like:Are you getting the issue while accessing the web ?
Step 1: just upload your all source code on the server (make sure database & .env set well) i) make zip and extract it ii) deploy code using git or take a clone from a repository and install all dependencies
Step 2: Make a .htaccess file on the project root directory and copy below code and paste it into this file.
I get this answer from this video so please say thanks to him https://www.youtube.com/watch?v=6Qbd9HTh7AE
Ref: How do I upload a laravel project on cPanel shared hosting?
or Try with a default Laravel and then upload your code
or create laravel project via Cpanel UI and try. Later replace with your custom code. Capture the key and .env files before replacing.