Question

Why the url request cannot be found in server?

I done creating my own API,and host it to Ubuntu 16.04.I created the phpmyadmin with Php One click install.

Done this 2 line of command in digital ocean console


 sudo a2enmod rewrite
 sudo service apache2 restart

I have my own .htaccess file which is like below

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ %{ENV:BASE}index.php [QSA,L]

And I transferred my file to /var/www/html this directory.

I edit the apache2.config as well like below as well

<Directory /var/www/>
	Options Indexes FollowSymLinks
	AllowOverride All
	Require all granted
</Directory>

But when I call my api in Postman it show me this result it state url not found.I request my address as http://MY_IP_ADDRESS/example/v1/register ,I am sure is correct URL.

Somebody please tell me what can I do to solve this problem.What am I missing out??

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

@matchartproduction

What you’d use really depends on how your application is setup to handle requests to index.php.

You may be able to use something such as:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php [NC,L,QSA]

or

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [NC,L,QSA]