pass a paramter to a script through .htaccess

Khaled Yousry asked
.htaccess parameters

I am able to execute script through .htaccess but I would like to pass a parameter to this script Is there a way to pass input parameter to a script in .htaccess? I am not able to set environment variable and use it inside the script. Is it possible to use environment variable defined in .htaccess in a script?

RewriteRule ^(.*)$ [E=VAR:$1,L]

I would like to pass VAR parameter to script to be executed like VAR


You can either pass it as a query string.

RewriteRule ^(.*)$$1 [E=VAR:$1,L]

Or, since it’s being set as an environment variable, read the current environment variables from inside of your script; i.e., VAR has been set as an environment variable in your example.

Share This
Posted in: