A
A
Azat Kiberov2019-02-16 19:17:00
htaccess
Azat Kiberov, 2019-02-16 19:17:00

How to leave the equal character in preg replace?

I ran into a problem. You need to correctly cut out the characters and leave the sign = .. But the request goes astray.
This code
preg_replace("/[^a-z0-9\/.:-]/i", "", $_POST["url"]);
You need to add the = sign and ?. Something like this
preg_replace("/[^a-z0-9\/.:-=?]/i", "", $_POST["url"]);
But the request doesn't work.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Viktor Taran, 2016-08-22
Babyak @sagnio

this is a redirect with a get request.
Get is not part of the url.
https://donatstudios.com/RewriteRule_Generator
Plus you will need to add "?"
so that the get is gone.

B
bkosun, 2019-02-16
@bkosun

To use a special character as a regular character, it must be escaped.
In other words, the character must be preceded by a backslash '\'.
php.net/manual/en/function.preg-quote.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question