I need to remove index.php? from URL.
From: https://example.com/index.php?/discover/
To: https://forum.fibaro.com/discover/
I t
I think you were trying to mach against URI only so, let me explain something here :
https://example.com/index.php?/discover/
This part index.php
is URI , then there is ?
and after that is /discover/
, the last part is query string so to match against it you could use QUERY_STRING or THE_REQUEST
Server-Variables according to what you need but when using REQUEST_URI
you match only against URI part.
Try the following:
RewriteEngine On
RewriteCond %{THE_REQUEST} ^[A-Z]{3,7}\s/index\.php\?\/(.*)\sHTTP.*$
RewriteRule ^index\.php$ /%1? [L,R=301]
RewriteRule !^index\.php$ /index.php?%{REQUEST_URI} [L]
The code above will redirect https://example.com/index.php?/discover/
to https://example.com/discover/
externally and then redirect it again to same path .
Note: clear browser cache then test it .