how can i rewrite /index.php?f=test
to /test
example : domain.com/?f=test
to domain.com/test
and I want to receive in PHP data as GET Request
<?php
$file = $_GET['f'];
// if url was domain.com/test/ $file must be test
?>
how can i rewrite /index.php?f=test
to /test
example : domain.com/?f=test
to domain.com/test
and I want to receive in PHP data as GET Request
<?php
$file = $_GET['f'];
// if url was domain.com/test/ $file must be test
?>
The index you are getting on your php file is because of the unconditional rule. your rule is causing an infinite redirect/double redirect. You need to exclude your existent files from the rule .
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([A-Za-z0-9-]+)/?$ index.php?f=$1