Answer the question
In order to leave comments, you need to log in
How to add "_" character to RewriteCond in .htaccess?
Currently there is this rule:
RewriteEngine on
RewriteCond %{REQUEST_URI} \/([0-9a-z\&\=\.\[\]\{\}\%\-]+)$ [NC]
RewriteRule ^ (.*) /hello.php?query=%1 [L]
It, as experts have already understood, sends from /hsdfs to /hello.php?query=hsdfs
hsdfs is a string that can contain characters 0-9, az, &, =, etc...
I need to add one more character "_" to these characters. But when I convert the second line like so:
RewriteCond %{REQUEST_URI} \/([0-9a-z\&\=\.\[\]\{\}\%\-\_]+)$ [NC]
or so
RewriteCond %{REQUEST_URI} \/([0-9a-z\&\=\.\[\]\{\}\%\-_]+)$ [NC]
I get 500 error...
How to achieve what you want result?
Answer the question
In order to leave comments, you need to log in
Resolved like this:
RewriteCond %{REQUEST_URI} \/([a-z0-9_[\]{}%&=-]+)$ [NC]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question