Deploy Laravel 11 project on Shared Hosting, the Easiest Way

Are you hosting a Laravel 11  project on your server but struggling to access it directly from your domain? Fear not, as configuring Apache redirect rules can seamlessly direct traffic to your Laravel project folder. 

after archiving and uploading your Laravel project to your cPanel 

Follow these steps to set up the redirect rules via the .htaccess file:

1. Locate Your Domain and Document Root

Navigate to your cPanel and find your domain name. Ensure that the document root points to the public_html directory.

 If your Laravel project resides in a folder within public_html (let’s call it awe_web), proceed to the next step.

2. Access the .htaccess File:

 Open your server (cpanel) and create public_html/.htaccess to edit the .htaccess file.

3. Add Redirect Rules: insert the following lines:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /YOUR_FOLDER/public/$1
RewriteCond %{HTTP_HOST} ^(www.)?$
RewriteRule ^(/)?$ YOUR_FOLDER/public/index.php [L]

Replace `YOUR_DOMAIN` with your registered domain name (e.g., and `YOUR_FOLDER` with the name of the folder containing your Laravel project files (e.g., _awe_web).

4. Save and Exit: 

After adding the redirect rules, save the changes to the .htaccess file and exit the editor.

5. Test Your Setup:  

Open a web browser and navigate to your domain (e.g., You should now seamlessly access your Laravel project without specifying the project folder in the URL.

By configuring these redirect rules, you ensure that Apache directs incoming requests to the appropriate folder within your server’s directory structure, allowing for smooth access to your Laravel application through your domain name.

Leave a Comment

Your email address will not be published. Required fields are marked *