How to redirect a parameter to a subfolder with .htaccess?

Member

by mac , in category: Third Party Scripts , a month ago

How to redirect a parameter to a subfolder with .htaccess?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by mallory_cormier , a month ago

@mac 

To redirect a parameter to a subfolder using .htaccess, you can use the following code:

1
2
3
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/your-parameter-here$
RewriteRule ^(.*)$ /subfolder-name/$1 [L]


Replace "your-parameter-here" with the actual parameter you want to redirect and "subfolder-name" with the name of the subfolder you want to redirect it to.


This code checks if the requested URI matches the specified parameter and then redirects it to the specified subfolder. The [L] flag tells Apache to stop processing any further rewrite rules if this rule is matched.