mirror of
https://github.com/phanan/htaccess.git
synced 2018-11-08 13:39:40 +01:00
added some translations
This commit is contained in:
parent
9befe2cf7f
commit
c306c4ccd1
1 changed files with 8 additions and 8 deletions
|
@ -53,26 +53,26 @@
|
||||||
- [Disable Internet Explorer Compatibility View](#disable-internet-explorer-compatibility-view)
|
- [Disable Internet Explorer Compatibility View](#disable-internet-explorer-compatibility-view)
|
||||||
- [Serve WebP Images](#serve-webp-images)
|
- [Serve WebP Images](#serve-webp-images)
|
||||||
|
|
||||||
## Rewrite and Redirection
|
## Rewrite и Redirect
|
||||||
Note: It is assumed that you have `mod_rewrite` installed and enabled.
|
Примечание: Предполагается, что модуль `mod_rewrite` установлен и включен.
|
||||||
|
|
||||||
### Force www
|
### Перенаправление с без www на с www
|
||||||
``` apacheconf
|
``` apacheconf
|
||||||
RewriteEngine on
|
RewriteEngine on
|
||||||
RewriteCond %{HTTP_HOST} ^example\.com [NC]
|
RewriteCond %{HTTP_HOST} ^example\.com [NC]
|
||||||
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301,NC]
|
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301,NC]
|
||||||
```
|
```
|
||||||
|
|
||||||
### Force www in a Generic Way
|
### Перенаправление с без www на с www для любого протокола (http или https)
|
||||||
``` apacheconf
|
``` apacheconf
|
||||||
RewriteCond %{HTTP_HOST} !^$
|
RewriteCond %{HTTP_HOST} !^$
|
||||||
RewriteCond %{HTTP_HOST} !^www\. [NC]
|
RewriteCond %{HTTP_HOST} !^www\. [NC]
|
||||||
RewriteCond %{HTTPS}s ^on(s)|
|
RewriteCond %{HTTPS}s ^on(s)|
|
||||||
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
|
||||||
```
|
```
|
||||||
This works for _any_ domain. [Source](https://stackoverflow.com/questions/4916222/htaccess-how-to-force-www-in-a-generic-way)
|
Это работает для _любого_ домена. [Источник](https://stackoverflow.com/questions/4916222/htaccess-how-to-force-www-in-a-generic-way)
|
||||||
|
|
||||||
### Force non-www
|
### Перенаправление с www на без www
|
||||||
It’s [still](http://www.sitepoint.com/domain-www-or-no-www/) [open](https://devcenter.heroku.com/articles/apex-domains) [for](http://yes-www.org/) [debate](http://no-www.org/) whether www or non-www is the way to go, so if you happen to be a fan of bare domains, here you go:
|
It’s [still](http://www.sitepoint.com/domain-www-or-no-www/) [open](https://devcenter.heroku.com/articles/apex-domains) [for](http://yes-www.org/) [debate](http://no-www.org/) whether www or non-www is the way to go, so if you happen to be a fan of bare domains, here you go:
|
||||||
``` apacheconf
|
``` apacheconf
|
||||||
RewriteEngine on
|
RewriteEngine on
|
||||||
|
@ -80,7 +80,7 @@ RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
|
||||||
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]
|
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]
|
||||||
```
|
```
|
||||||
|
|
||||||
### Force non-www in a Generic Way
|
### Перенаправление с www на без www для любого протокола (http или https)
|
||||||
``` apacheconf
|
``` apacheconf
|
||||||
RewriteEngine on
|
RewriteEngine on
|
||||||
RewriteCond %{HTTP_HOST} ^www\.
|
RewriteCond %{HTTP_HOST} ^www\.
|
||||||
|
@ -89,7 +89,7 @@ RewriteCond http%1://%{HTTP_HOST} ^(https?://)(www\.)?(.+)$
|
||||||
RewriteRule ^ %1%3%{REQUEST_URI} [R=301,L]
|
RewriteRule ^ %1%3%{REQUEST_URI} [R=301,L]
|
||||||
```
|
```
|
||||||
|
|
||||||
### Force HTTPS
|
### Перенаправление на HTTPS
|
||||||
``` apacheconf
|
``` apacheconf
|
||||||
RewriteEngine on
|
RewriteEngine on
|
||||||
RewriteCond %{HTTPS} !on
|
RewriteCond %{HTTPS} !on
|
||||||
|
|
Loading…
Reference in a new issue