1

How do i fixed the trailing slash problem?

I tried How to access directory's index.php without a trailing slash AND not get 301 redirect. Adding the htaccess DirectorySlash Off etc but it doesnt work.

Image Link For the POST Response https://i.stack.imgur.com/n2TVA.jpg

Code For the API POST:

$response = "";
if(empty($_POST)) {
    $response = array("Message"=>"Post Not Success");
} else {
    $data = $_POST['name'];
    $response = array("Message"=>"Post Success","Name"=>$data);
}
echo json_encode($response, JSON_FORCE_OBJECT);
Alex
  • 47
  • 5
  • Can you provide some expample code what you tried so far? – Jens Baitinger Mar 08 '21 at 09:14
  • Hi Jens, thanks for the reply. I wrote test code and images of the response from the API URL. Notice that the left image post url with trailing slash is giving the right POST values and the right image post url doesnt get the post values. – Alex Mar 08 '21 at 09:44
  • thanks for clarification of your question. now its easy for someone to answer your question – Jens Baitinger Mar 08 '21 at 09:52

0 Answers0