Laravel: issues encountered (1)

LOCALHOST

this is a headache – mainly because using localhost will cause the FRONT FACING path (public directory) is not the ROOT directory

For example:

localhost/myblog/public/

Path: C:\wamp\www\myblog\public

This pose a problem when routing within the website

Comment:

<form method="POST" action="/posts/{{ $postid->post_id }}/comments">
Route::post('/posts/{postid}/comments', 'CommentsController@Store')->name('storeComment');

RESULTS:
<form method="POST" action="myblog/public/posts/{{ $postid->post_id }}/comments/">
http://localhost/posts/myblog/public/posts/2/comments

<form method="POST" action="/myblog/public/posts/{{ $postid->post_id }}/comments/">
http://localhost/posts/2/comments

So we have to setup a local domain

myblog.lists.this

C:\Windows\System32\drivers\etc

127.0.0.1 myblog.lists.this              # x client host

And APACHE VHOSTS

#

<VirtualHost *:80>
	ServerName myblog.lists.this
	ServerAlias myblog.lists.this
	DocumentRoot C:/wamp/www/myblog/public
	<Directory  "c:/wamp/www/myblog/public">
		Options +Indexes +Includes +FollowSymLinks +MultiViews
		AllowOverride All
		Require local
	</Directory>

 

Leave a Reply

Your email address will not be published. Required fields are marked *