.htaccess not removing this: index.php?

0

Issue

So, I’ve recently coded a PHP API for one of my websites, but I am trying to make it remove the ?

Along with index.php so let’s say I go to http://api.url.com/index.php?Method

I could actually go to http://api.url.com/Method and it work the same as it would.

I’ve tried other .htaccess’s but nothing seems to work.

Solution

Write Below Code in your .htaccess file

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

Answered By – Sujal Patel

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More