original url is one of the following:
example.com
example.com/index.php
example.com/index.php?c=lorem
if example.com
– nothing should be done
if example.com/index.php
– it should be visible as example.com
and here is my code – works fine:
RewriteEngine ON
RewriteRule ^index.php/?$ https://%{HTTP_HOST}/ [NC,R=301]
RewriteRule ^/?$ index.php [L]
if example.com/index.php?c=lorem
it should be visible as example.com/lorem
and lorem
should be accessible by php in both cases:
- if a user type
example.com/index.php?c=lorem
or - a user type
example.com/lorem
pls help
2
Answers
You may use these rules in your site root .htaccess:
Could you please try following, based on your shown samples.
Please do clear your browser cache before testing your URLs.
OR: Above is for specifically
lorem
in case your query string could be anything then try following.