Monday, March 5, 2018

How to remove "public/index.php" in laravel 5.4 project for both local and shared hosting server? - development

How to remove “public/index.php” in laravel 5.4 project for both local and shared hosting server?

Here is what i got, i tried putting .htaccess on root with following code :

<IfModule mod_rewrite.c>
   RewriteEngine On 
   RewriteRule ^(.*)$ public/$1 [L]
</IfModule>

And on public folder .htaccess

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

    RewriteEngine On

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>

This is error i’m having on localhost :
Sorry, the page you are looking for could not be found on localhost

And this is the error i’m having on shared hosting server :
Plesk Server Shared Hosting error

"require": {
        "php": ">=5.6.4",
        "laravel/framework": "5.4.*",
        "laravel/tinker": "~1.0",
        "laravelcollective/html": "^5.4.0"
    }

No success yet. Please help i couldn’t sleep



from Laravel Questions and Answers https://laravelquestions.com/laravel/how-to-remove-public-index-php-in-laravel-5-4-project-for-both-local-and-shared-hosting-server/
via Lzo Media

No comments:

Post a Comment