0

Similarly to Route on Laravel keeps redirecting (301) to root of website, I have an issue where adding a slash to the end of a url will make it go to the root of the site. Example: mysite.com/laravel/members/ will go to mysite.com/members.

Route::get('members/{member?}', ['as' => 'memberPage', 'uses' => 'MembershipController@showMember',  'before' => 'auth']);

Anyone have any ideas?

Community
  • 1
  • 1
Z61
  • 109
  • 1
  • 3
  • 9

1 Answers1

0

Don't serve Laravel on localhost/laravel this is a bad idea. You will not do this in real application anyways.

You need to you use virtual hosts in order to Laravel function properly. You can do that by usingphp artisan serve command, Here's what you may want to do

  1. Go to the folder where you located the project.

  2. Open up the Terminal or if you're on Windows open up Command Prompt.

  3. Type this in CMD or Terminal:

php artisan serve --port=8080 --host=app.dev

This is the easiest way to setup virtual host. So then in your browser you can access it by going to: app.dev:8080

Unfortunately this is not a permanent solution, the virtual host will be gone when you close the Terminal or the Command Prompt.

You can create virtual host permanently by editing Apache Configuration files.

If you want that, click here for Windows, or click here for Linux.

Akar
  • 4,687
  • 2
  • 22
  • 38
  • As I said in the comments to my question, I don't use it locally and haven't. It still doesn't work on the server it's deployed on. – Z61 May 21 '15 at 09:02
  • @Z61 You deployed it wrong. Check here: http://stackoverflow.com/questions/22023048/laravel-4-and-the-way-to-deploy-app-using-ftp – Akar May 21 '15 at 09:10
  • I did it exactly as it's said in that answer. I only have an issue with one route, not all of them. – Z61 May 21 '15 at 17:02