如何为Ngnix重写Apache指令
是否可以为Ngnix重写下一个Apache指令 1.设置默认字符集编码 阿帕奇:如何为Ngnix重写Apache指令,apache,configuration,nginx,Apache,Configuration,Nginx,是否可以为Ngnix重写下一个Apache指令 1.设置默认字符集编码 阿帕奇: AddDefaultCharset UTF-8 2.重定向到一个域进行搜索引擎优化 阿帕奇: <IfModule mod_rewrite.c\> Options +Followsymlinks RewriteEngine On RewriteCond %{HTTP_HOST} ^domain\.com [OR] RewriteCond %{HTTP_HOST} ^do
AddDefaultCharset UTF-8
2.重定向到一个域进行搜索引擎优化
阿帕奇:
<IfModule mod_rewrite.c\>
Options +Followsymlinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain\.com [OR]
RewriteCond %{HTTP_HOST} ^domain2\.com [OR]
RewriteCond %{HTTP_HOST} ^www\.domain2\.com
RewriteRule ^(.*)$ http://www.domain2.com/$1 [R=301,L]
</IfModule>
AddOutputFilterByType DEFLATE text/css
4.文本压缩
阿帕奇:
<IfModule mod_rewrite.c\>
Options +Followsymlinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain\.com [OR]
RewriteCond %{HTTP_HOST} ^domain2\.com [OR]
RewriteCond %{HTTP_HOST} ^www\.domain2\.com
RewriteRule ^(.*)$ http://www.domain2.com/$1 [R=301,L]
</IfModule>
AddOutputFilterByType DEFLATE text/css
一,
二,
三,
四,
server {
server_name domain.com;
server_name domain2.com;
server_name www.domain.com; # www.domain2.com in RewriteCond, you mean www.domain.com?
return 301 $scheme://www.domain2.com/$request_uri;
}
expires max;
gzip on