Hello. There is a question about mod_rewrite 'y. How can you make mysite.ru/auto/ from such a URL mysite.ru/auto/ . Will it be possible to use Russian letters?
|
3 answers
# Правило для главной страницы RewriteRule ^\/?$ public/index.php?title=default [L,QSA] #Правило для остальных страниц RewriteRule ^[a-zA-Z0-9]+\/?$ public/index.php?title=auto [L,QSA] Unfortunately, with Russian letters such magic does not roll (in any case, the trivial code is so accurate), but no one bothers us to transfer Russian values to GET (in the rules this is implemented using the QSA flag).
For an example of transferring fully Russian GET parameters, let's write simple PHP code:
header("Content-Type: text/html; charset=UTF-8"); // мы не хотим крякозябров if(!empty($_GET['язык'])) { echo 'Вы выбрали ' . $_GET['язык'] . ' язык'; } Naturally, this code will be placed in index.php, we will enter in the URL, for example, mysite.ru/? Language = Russian, and we will see that everything works fine.
|
RewriteEngine on RewriteRule (.*) index.php?title=$1 |
if specifically for this address, then somehow
RewriteEngine on RewriteRule ^auto/$ index.php?title=auto |