0

I've followed this and this answers to remove /public form the URL of my Laravel project. Now /public is removed from the URL. But my IDE (phpstorm) is throwing an error:

enter image description here

Does anybody know how can I fix it?

Note: I use Laravel 5.4

Martin AJ
  • 6,261
  • 8
  • 53
  • 111
  • Both those two other answers you followed are half-truths. They solve the issue by changing the wrong thing. _All_ you need to do is to change the document root in your webserver config. That is all. No other code changes are required. See https://stackoverflow.com/a/35640738 – sisve Jun 11 '17 at 05:38
  • try `composer dump-autoload` – Hamid Haghdoost Jun 11 '17 at 05:42
  • The links you saw are explaining how to remove `public` from the path if you cannot set the server root to `/public` to begin with. Is that the case with you as well? – apokryfos Jun 11 '17 at 06:01
  • you don't need to edit in your code just follow @aimme answer – Ajay Kumar Jun 11 '17 at 08:32

2 Answers2

2

Change your apache vhost / host document root to projects public folder. its realted to apache config.

<VirtualHost *:80>
  ServerName findexample.com
  DocumentRoot c:/xampp/htdocs/find_people/public

  <Directory c:/xampp/htdocs/find_people/public>
    Options Indexes FollowSymLinks
    AllowOverride all
    Require all granted
  </Directory>

  ErrorLog ${APACHE_LOG_DIR}/find-people-error.log
  CustomLog ${APACHE_LOG_DIR}/find-people-access.log combined

</VirtualHost>

See how to setup apache vhost on windows

aimme
  • 6,385
  • 7
  • 48
  • 65
1

You dont need to touch on any file to get what you want.

Try setting your document root to

path/to/your/laravel_app/public/

If your root is pointing to your public folder, when you access it from Browser, you will not need to use public in the url.

Remember that you must enable ModRewrite.