Laravel project load from project root

Laravel project load from project root

Try to load laravel project file from root directory

Follow the steps.

  1. Go to your laravel root directory 
  2. Create a file .htaccess
  3. Paste the <IfModule> code block and
  4. Clear the Browser cache
  5. Load the project.

Paste this code .htaccess file on your laravel project root folder.

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} -d [OR]
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule ^ ^$1 [N]

    RewriteCond %{REQUEST_URI} (\.\w+$) [NC]
    RewriteRule ^(.*)$ public/$1

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ server.php

</IfModule>

Force http to https

<IfModule mod_rewrite.c>

    # ensure https
    RewriteCond %{HTTP:X-Forwarded-Proto} !https
    RewriteCond %{HTTPS} off
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

</IfModule>

Force to https://www.

<IfModule mod_rewrite.c>

    # ensure www.
    RewriteCond %{HTTP_HOST} !^www\. [NC]
    RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

</IfModule>


Sumon Ahmed

Sumon Ahmed

I'm Shafiqul Islam, Web Programmer & Developer. Have long experience for more than three years. I passed my professional training from IDB-BISEW. My major subject was Web Application Development with PHP and Frameworks(WDPF). You can visit another section to know about my skill, service, portfolio and more.