I have a website hosted on my local server (http://localhost/), which uses url_rewriting.
When I access a page with the browser, no issue, it’s loading.
But when I access the same url with PHP cUrl, I get a 404.
Example:
URL with mod_rewrite: http://localhost/site/test
Real page: http://localhost/site/test.php
Loading http://localhost/site/test from Firefox: Working
Loading using cUrl:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://localhost/site/test");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$output = curl_exec($ch);
curl_close($ch);
$output -> 404 page from apache
Anybody knows why cUrl returns a 404 message?
Turns out this has nothing to do with mod_rewrite.
One of the directory in the URL had a space in it, that I was not encoding when calling the cUrl function.
Once replaced all space by %20, everything worked fine.
Subject closed.