0

I have created an htaacess file as mentioned at below link

icodehub.in

After creating htaccess file and writing below code in it I am able to access my public folder without writing public in url but still framework is not working properly like: 1. when I die a text inside index.php it is showing up on webpage but once the line "$response->send();" execute it error blade starts showing and images and other asset's url looks like this :

http://localhost/common/images/404.jpg

http://localhost/common/images/404.jpg

My .htaccess file outside public which I have created myself:

<IfModule mod_rewrite.c>

  RewriteEngine On

  RewriteRule ^(.*)$ public/$1 [L]

</IfModule>

The solutions I found on SO and other sites are to place index and htaccess file outside public folder on project root. But I don't want to do that I want to change htaccess only so that I don't have to write public in my urls. Creating virtual host was also the solution but I also don't want to do that.

Please suggest If anyone know solutions other than creating virtual host or moving files outside public folder.

Already referred below solutions:

  1. Laravel 5 - Remove public from URL
  2. http://icodehub.in/remove-public-from-url-laravel-5/

  3. http://tutsnare.com/remove-public-from-url-laravel/

  4. http://laravel.io/forum/03-11-2014-removing-public-from-url

    etc.

Thanks!

Update After installing a fresh project when I followed same step that is creating htaccess file on project root and writing below code in it I got below error:

htaccess file code:

<IfModule mod_rewrite.c>

  RewriteEngine On

  RewriteRule ^(.*)$ public/$1 [L]

</IfModule>

error

Sorry, the page you are looking for could not be found.

1/1 NotFoundHttpException in RouteCollection.php line 161:

Community
  • 1
  • 1
Always_a_learner
  • 4,585
  • 13
  • 63
  • 112
  • Well, it would be much better if you point your domain to public folder, in this case you dont need to move `index.php` and `.htaccess` file – Qazi Oct 04 '16 at 09:41
  • @Qazi you mean in apache config file? – Always_a_learner Oct 04 '16 at 09:43
  • I have referred answer by ka_lin "stackoverflow.com/questions/28364496/…; and changed my server.php file to index.php and also copied the htaccess file content he mentioned. and it worked but my problem is that I don't want to change any file's location. – – Always_a_learner Oct 04 '16 at 09:58

0 Answers0