📲 Download Our Apps

EMI Calculator

Download EMI Calculator

SOA Games

Download SOA Games

SOA Technology App

Download SOA Technology

BMI Checker

Download BMI Checker

Task Jira

Download Task Jira

Laughing Adda

Download Laughing Adda

📅 हिंदी कैलेंडर ऐप डाउनलोड करें

Download Shubhcalendar App

lavarel 10 being download on cpanel server

To install Laravel 10 on shared hosting and handle the issue with the public directory, you can follow these steps:

  1. Upload Your Laravel Application:
    • Compress your Laravel application into a zip file.
    • Upload the zip file to your shared hosting account, usually through a cPanel file manager or via FTP.
    • Extract the zip file to the desired directory on your shared hosting.
  2. Modify the public Directory:
    • Since you can’t change the document root, you’ll need to move the contents of the public directory to the root directory of your domain (often public_html or htdocs).
    • Move the .htaccess and index.php files from the public directory to the root directory.
  3. Update index.php:
    • Edit the index.php file in the root directory to update the paths to autoload.php and app.php:
    Copyrequire __DIR__.'/../vendor/autoload.php'; $app = require_once __DIR__.'/../bootstrap/app.php'; Change these lines to (assuming that the rest of your Laravel app is one level above the public_html):Copyrequire __DIR__.'/../your-laravel-directory/vendor/autoload.php'; $app = require_once __DIR__.'/../your-laravel-directory/bootstrap/app.php';
  4. Create or Modify the Root .htaccess File:
    • If you don’t already have a .htaccess file in your root directory, create one.
    • Add the following rules to handle the redirection and removal of the /public from the URL:
    Copy<IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^(.*)$ public/ [L] </IfModule>
    • If you’re facing issues with trailing slashes, you can add the following rules to handle that:
    Copy<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} (.+)/$ RewriteRule ^ %1 [L,R=301] RewriteRule ^(.*)$ public/ [L] </IfModule> This will remove the trailing slash for non-directory requests and then rewrite the request to the public directory.
  5. Secure Sensitive Directories:
    • To prevent public access to sensitive directories like /vendor or your .env file, you can add additional rules to your .htaccess file:
    Copy<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_URI} ^/(vendor|storage|.env)(/|$) RewriteRule ^ - [F,L,NC] </IfModule>
  6. Test Your Application:
    • After making these changes, visit your website and test to ensure that everything is working correctly.
    • Check different routes and add trailing slashes to see if the redirection works as expected.

Remember to replace your-laravel-directory with the actual directory name where your Laravel application resides on the server. Also, ensure that your server meets all the requirements for running Laravel 10, such as PHP version and necessary PHP extensions.




Leave a Reply

AI Spiritual Tools & Interactive Experiences

Explore powerful AI-driven tools for daily guidance, spirituality, fun quizzes, and self-discovery.

Today’s Quote

Get inspiring daily quotes powered by AI to motivate and guide your day.

Explore Now

AI Tarot Card Reader

Reveal insights about your future, love, and career with AI tarot readings.

Read Tarot

Love Match Calculator

Check compatibility and love predictions using AI-based analysis.

Check Match

Fortune Cookie

Open an AI fortune cookie and receive wisdom, luck, and fun messages.

Open Cookie

Quiz Categories

Engage with knowledge-based and fun quizzes across multiple categories.

Start Quiz

Panchang Calendar

View daily Panchang, auspicious timings, tithi, nakshatra, and festivals.

View Panchang

Online Numerology

Discover your destiny number, life path, and numerology predictions.

Calculate Now

Spiritual Feeds

Stay connected with spiritual thoughts, mantras, and divine content.

View Feeds

Quiz Hub

Attempt trending quizzes on GK, spirituality, festivals, and more.

Explore Quizzes