Answer the question
In order to leave comments, you need to log in
How to make beautiful url with htaccess?
In general, there are a lot of links on this topic, but since I am a noob on the topic of administration, I spent a lot of time, but it didn’t work.
Task 1:
Redirect based on language
Code:
RewriteEngine on
# редирект на русскоязычную версию сайта для русских, украинских, белорусских и казахских браузеров
RewriteCond %{REQUEST_URI} ^/$ [NC]
RewriteCond %{HTTP:Accept-Language} (ru|uk|by|kz) [NC]
RewriteRule .* http://propeller-app.com/pages/ru/index.html [R=301,L]
# редирект на англоязычную версию сайта для всех остальных языков
RewriteCond %{REQUEST_URI} ^/$ [NC]
RewriteRule .* http://propeller-app.com/pages/en/index.html [R=301,L]
DirectoryIndex /pages/ru/index.html
RewriteRule ^(|/)$ http://propeller-app.com/ru/index.html [L]
RewriteCond %{REQUEST_URI} !^(|/)
RewriteCond %{REQUEST_URI} !/pages
RewriteCond %{REQUEST_URI} !\.html$
RewriteRule (.*) /pages/$1.html [L]
RewriteCond %{REQUEST_URI} !/pages
RewriteCond %{REQUEST_URI} .html$
RewriteRule (.*) /pages/$1 [L]
RewriteBase /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^.]+)\.html\ HTTP
RewriteRule ^([^.]+)\.html$ http://site.ru/$1 [R=301,L]
RewriteCond %{REQUEST_URI} !(\.[^./]+)$
RewriteCond %{REQUEST_fileNAME} !-d
RewriteCond %{REQUEST_fileNAME} !-f
RewriteRule (.*) /$1.html [L]
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question