Nutchapat W.
Nutchapat W.

Reputation: 1

how to set htaccess on /var/www/html/blog/ for laravel 5.6

My objective

  1. I want to set DocumentRoot "/var/www/html"
  2. My laravel project is located in /var/www/html/blog
  3. File /var/www/html/blog/routes/web.php set routes Route::get('demo','DemoController@index');
  4. I need to Request to call <HTTP_HOST>/blog/public/demo to call DemoController

Question - If I want to use URL to <HTTP_HOST>/blog/demo replace <HTTP_HOST>/blog/public/demo, How to write .htaccess at /var/www/html/blog/?

Upvotes: 0

Views: 1711

Answers (1)

Rajdip Chauhan
Rajdip Chauhan

Reputation: 345

Create a .htaccess file your Laravel root directory if it does not exists already.

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

Try with this. Hope its help you.

Upvotes: 1

Related Questions