Khaled Yousry asked
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 ^(.*)$ new.sh [E=VAR:$1,L]
I would like to pass VAR parameter to new.sh script
to be executed like
You can either pass it as a query string.
RewriteRule ^(.*)$ new.sh?VAR=$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.