Home » Php » php – Multiple variables in .htaccess

php – Multiple variables in .htaccess

Posted by: admin February 25, 2020 Leave a comment

Questions:

i want to make my URL become from this:
www.mysite.com/index.php?area=test1&par=test2
to this:
www.mysite.com/test1/test2

my .htaccess look like that:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*?)/?$ /index.php?area=$1 [L]
DirectoryIndex index.php

i get only the area variable, and dont know how to continue from here.

How to&Answers:

why not simply pass all to php like

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]

than process it in php

var_dump($_SERVER);//parse all info you want