Answer the question
In order to leave comments, you need to log in
How to properly set up substitution in .htaccess?
There is a path on the old site
/design/logo
on the new site, this path looks like this
/design-logo
It is necessary to configure htaccess so that when going to the old url the user does not see the address substitution, but in fact goes to the new
My code, which does not work. (similar code without cyrillic works)
RewriteEngine on
RewriteBase /~quux/
RewriteRule ^%D0%B4%D0%B8%D0%B7%D0%B0%D0%B9%D0%BD-%D0%BB%D0%BE%D0%B3%D0%BE%D1%82%D0%B8%D0%BF$ %D0%B4%D0%B8%D0%B7%D0%B0%D0%B9%D0%BD/%D0%BB%D0%BE%D0%B3%D0%BE%D1%82%D0%B8%D0%BF
Answer the question
In order to leave comments, you need to log in
Remove the $ in the RewriteRule, at the very least. Or rewrite the regexp in a different way:
Be sure to escape the %, like this: \%, or even like this: \\%. There was a case when I had to play as many as 4 backslashes! The point is that the % character in the RewriteRule has its own meaning.
I did not find a direct dependence of the number of slashes on the version of Apache, apparently it depends on the version of the library for working with regexps, with which a particular assembly is compiled. This is especially true for LINUX systems, where Apache is assembled "on the spot" or prepared by "craftsmen" for laying in the repository.
If Apache is set to default utf-8, and the version is at least 2.2.1, and the .htaccess file is saved in utf-8, then the rule can be written like this:
Or like this:
More info: httpd.apache.org/docs/2.4/en/rewrite/intro.html
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question