Reputation: 13
I have queries like this:
example.com/folder/?q=keyword
Please suggest how to redirect all queries that contain "keyword" as a parameter to other file on server:
/folder/core/index.php?id=$1
I mean $1
must be keyword
Here is my example:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^q=\/(.*)$
RewriteRule ^/?$ /folder/core/index.php?id=$1 [L]
Upvotes: 1
Views: 1489
Reputation: 7476
If you are using .htaccess in folder/
directory then try with below,
RewriteEngine On
RewriteCond %{QUERY_STRING} ^q=(.+)$
RewriteRule ^ /folder/core/index.php?id=%1 [QSA,L]
Upvotes: 1