PHP query string without question mark
If you want to pass variables in the URL without having to use ?var=value format, then you will need .htaccess file and a URL RewriteRule.
For example, let’s say we want to pass a variable via the query string http://www.phpdebutant.com/var1=value1, then we would use a .htaccess file and place it in the public_html folder.
The .htaccess file would like this:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.+)=(.+)$ /index.php?$1=$2
Notice the use of regular expression:
^ denotes the beginning of the line
$ denotes the end of the line
We use ( ) to enclose a regular expression match, so the value of the first match would be in $1, and second would be in $2.
The RewriteRule says that whatever query matches that regular expression, we would redirect the request to /index.php?$1=$2 where $1 and $2 are the values of the match.