1

The apache root Document is ~/Sites/ .

My laravel project is called laravelTest in the ~/Sites/laravelTest

The index url is http://localhost/laravel/public/index.php

And restful url is http://localhost/laravel/public/index.php/$1/$2 ...

How can I remove the /public/index.php?

How do I setting the .htaccess file...

I only can remove the index.php ,but can't remove the /public/

Thanks.

5
  • 1
    This one ? Commented Aug 6, 2015 at 3:59
  • But it's not work for me... Commented Aug 6, 2015 at 5:56
  • The url localhost/laravelTest/public => can go my index page now I want change to => localhost/laravelTest and I want restful url like localhost/laravel/$1/$2 Sorry I am apache noob lol Commented Aug 6, 2015 at 6:11
  • localhost/laravelTest/public to localhost/laravel So You want to change laravelTest to larael and then remove public too ? Commented Aug 6, 2015 at 6:31
  • I miss the Test i just want remove the public. And I see the document, but don't know how to use it... Commented Aug 6, 2015 at 6:38

1 Answer 1

2

There are many solutions for removing the index.php in Laravel 4,5 to remove public/index.php from URL

I would recommend you this simple step

  1. Rename the file server.php in the your Laravel root folder to index.php

  2. Move the .htaccess file from /public directory to your Laravel root folder.

Ref : As simple like this

Sign up to request clarification or add additional context in comments.

8 Comments

yeah , its work for me... But can't only use .htaccess file to control this?
We can do it but there are some severe cautions because of it. That's the reason i suggest this :)
And I also has question. Now I can view my index in localhost/laravelTest but I thought localhost/laravelTest/public the resource(ex: img ) is 404 But i use laravel's Illuminate\Html provider for js ,css is work find. How can I use this for my img?
Sorry for late reply. Have you found the way ? or shall i help you ?
No, I hav't foud the solution. Can yout help me? Then I got another peoblem. lol I do something in my controller then I want redirect to another website ,but the page nothing happend... I use return redirect()->away('google.com'); Redirect::away('google.com'); Redirect::refresh('google.com'); Redirect::to('google.com'); but it doesn't work and no error.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.