4

I moved Laravel file to subfolder and hit url localhost/test/public it's working fine but I want to use url localhost/test. I put .htaccess in test folder but than localhost/test showing 404

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

2 Answers 2

1

create a .htaccess file in your root path

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/public/
RewriteRule ^(.*)$ /public/$1 [L,QSA]
Sign up to request clarification or add additional context in comments.

Comments

1
  • Mover index.php and .htacces file from public folder to test or App Root folder.
  • Modify index.php like this

    require __DIR__.'vendor/autoload.php';

    $app = require_once __DIR__.'bootstrap/app.php';

And if your css and js stops working add {{asset('public')}}/ before your imports, for example

<link href="{{ asset('public') }}/demo/demo.css" rel="stylesheet" />
<script src="{{ asset('public') }}/js/core/jquery.min.js"></script>

then you can access your website at http://localhost/test

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.