0

I want to make pretty URLs in this format www.example.com/countryId/stateid but I want my API end-point to route to index.php in /public folder.

Options +FollowSymLinks
RewriteEngine On

RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f

RewriteRule ^ index.php [L]

I keep getting 404 error and I don't know where am getting it wrong. This is my URL "http://localhost/location/src/public/countryId/stateId" and I want the URL endpoint to route to http://localhost/location/src/public/index.php. The .htaccess file exists in public/.htaccess where index.php is

  • Refer to this answer https://stackoverflow.com/a/25081097/6411031 – Brand Guy Feb 01 '20 at 00:54
  • That will mean refactoring the whole application because at some point, the application was working – Daniel Greatman Walter Feb 01 '20 at 04:10
  • Somehow, you have to capture the pieces of the url that is being redirected; otherwise how would you show different pages? If the application was working at some point, look to see how it was getting that information, and that will give you insight on how your htaccess needs to feed that info to index.php – Tim Morton Feb 01 '20 at 04:49

0 Answers0