在请求中有特殊字符时重定向到root - laravel 5

here's my routes file:

Route::any('target',function(){
    return 'got it!';
});

here's my form:

<form method='post' action='example.com/target'>
    <input type='text' name='message' />
    <input type='submit' name='submit' />
</form>

so It doesn't matter what I fill as the message field , It should return me got it!
but when I enter a url in message field , no matter the method is POST or GET , whether the path exist's or not, I get redirected to the root (example.com)
I don't have this problem on localhost, but on the shared host
thanks

Check your APP_URL env variable in config/app.php

Make sure once you are in production (or any other env for that matter), this value is changed accordingly.


edit:

Also check your action, either use named routes and route('route-name') or the url helpers to get proper urls.

Url helpers:

<form method="post" action="{{ Url::to('/target') }}">

Named routes:

 Route::any('target', function(){
     return 'got it!';
 })->name('target-name');

With your form action like this:

 <form method="post" action="{{ route('target-name') }}">

Also, is that the only route you have specified? Or are there more routes defined where you use target ?

change your action into this action='/target'

You can change your code in 2 ways.

First of all change the route like this

Route::get('/target', array('as'=>'target_name','uses'=>function(){
       return 'got it!';
}));

After that you can use like this way

1) <form method="post" action="{{ URL::to('/target') }}">

or

2) <form method="post" action="{{ URL::route('target_name') }}">

Thanks