Reputation: 498
I have a URL like this:
I have a physical folder folder
, everything after folder
should be GET-Parameters, so I get this in PHP:
<?php
$mode = $_GET["mode"]; // j
$type = $_GET["type"]; // i
$param1 = $_GET["param1"] // 123
$param2 = $_GET["param2"] // 456
At the moment I tried something like that:
RewriteEngine On
RewriteBase /folder
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?mode=$1& [L,QSA]
I don't get, how do I call more than one Parameter?
Thank you!
Upvotes: 1
Views: 64
Reputation: 113
A better way will be using PHP to explode GET arguments using "/" as delimiter.
Upvotes: 0
Reputation: 786091
Inside /folder/.htaccess
you can have this rule:
RewriteEngine On
RewriteBase /folder/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)/?$ index.php?mode=$1&type=$2 [L,QSA]
This will route https://example.com/folder/j/i?param1=123¶m2=456
to https://example.com/folder/index.php?mode=j&type=i¶m1=123¶m2=456
Upvotes: 1