Linux-Apache开启Https配置脚本和.htaccess不影响搜索引擎收录规则-站长杂谈下载

Linux-Apache开启Https配置脚本和.htaccess不影响搜索引擎收录规则

开通本站Svip会员,全站资源免费下

Emlog开启全站https还是很方便的,直接在后台把地址修改为https的然后更新缓存数据就全站https了。https各大搜索引擎目前都不会很友好的收录,所以我们必须用规则来让引擎访问我们网站的时候打开的是http页面,这也是目前唯一http网站不影响收录的解决方案。IIS那种403跳转就算了吧,严重影响收录。

直接上分享,你懂的。 443配置(注意把3个服务器证书也改成自己的路径):
  1. <VirtualHost *:443>
    * v  p' _* O0 Z9 j
  2.             DocumentRoot /data/www/web/web0001/) M9 Z- e; `" V1 p+ o
  3.             ServerName localhost:443+ a5 S& i% f4 }
  4.             SSLEngine on3 q3 v* v4 V/ v
  5.             SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL* C+ F6 B9 E! t1 `; o
  6.             SSLCertificateFile /data/limhme.crt
    % x$ ~- R# V5 V; c- |  N7 D
  7.             SSLCertificateKeyFile /data/limhme.key
    8 K; L& T( ^; [1 N7 c# w
  8.             SSLCertificateChainFile /data/root_bundle.crt$ F6 z  j; c! Z0 N, G  A" F
  9.             <FilesMatch "\.(cgi|shtml|phtml|php)$">0 L( f4 e6 l* U
  10.                     SSLOptions +StdEnvVars
    + i5 ?' k- l: y2 D# N4 {
  11.             </FilesMatch>
    4 u4 v# m% ^" H! v  y" o
  12.             <Directory /data/www/web/web0001/>
    2 k! S0 J/ [2 g& D1 S
  13.                     Order allow,deny
    9 U; Z% @5 e$ V' q
  14.                     Allow from all
    ; ]1 r9 H+ n' O9 i7 ~% j: w8 ^% t
  15.                     Options Indexes FollowSymLinks; }; _4 D# K2 q
  16.                     AllowOverride All
    " d4 {. p! v8 c; `2 g+ N2 V
  17.             </Directory>7 a9 P' [; g$ L1 k3 C
  18.             BrowserMatch ".*MSIE.*" \
    , k8 Z1 x$ i; i' }* n, M
  19.                     nokeepalive ssl-unclean-shutdown \
    8 ]" G. ]: H8 `2 R8 e- N! h- P- r& K
  20.                     downgrade-1.0 force-response-1.0. D2 E5 ?" Q4 X! A
  21.             ErrorLog logs/dummy-host.example.com-error_log( o! _& z0 H1 c/ o. o" ]) L
  22.             CustomLog logs/dummy-host.example.com-access_log common
    , D+ G+ d, U6 i' P* Y. `; F
  23. </VirtualHost>
复制代码
80配置:
  1. <VirtualHost *>+ D  [- f/ O* C; x3 a# D
  2.     DocumentRoot /data/www/web/web0001/
    7 v/ [7 S) D; Y4 |4 H
  3.     ServerName web0001# o; ]2 E* @9 h% B0 V5 i
  4.     ServerAlias tuyuanma.com
    $ B5 a  ]5 f/ M+ v" `
  5.     ServerAlias www.tuyuanma.com
    % ^6 _+ s4 y6 _! R3 L
  6.     <Directory /data/www/web/web0001/>8 O7 O' x  h& f+ [9 y" `) `6 I
  7.         AllowOverride FileInfo
    " s: d; @3 C/ E# e4 i5 j0 C
  8.     </Directory>
    * [3 z0 L6 [8 X! C7 z
  9. </VirtualHost>
复制代码
Emlog伪静态规则包含 www.tuyuanma.com 重定向tuyuanma.com,http重定向https,搜索引擎自动http不影响收录的.htaccess规则:
6 a7 {: a6 Q# r4 ^: q& {, f
  1. RewriteEngine on
    % k+ I; X6 D* a9 U) F4 E
  2. RewriteCond %{http_host} ^www.<span style="color: rgb(0, 0, 0);">tuyuanma.com</span> [NC]
    ( \; H  k: I2 v3 G$ S8 o
  3. RewriteRule ^(.*)$ https://<span style="color: rgb(0, 0, 0);">tuyuanma.com</span>/$1 [L,R=301]
    " ^& Y# Q. A! y% T
  4. RewriteCond %{SERVER_PORT} !^443$( C8 \  I4 o" s- T/ D& S2 a! l
  5. RewriteCond %{HTTP_USER_AGENT} !(baiduspider|soso|bing|sogou|yahoo|sohu-search|yodao|robozilla|msnbot|msie|feedburner) [NC]8 V  ?9 O8 @  c) [- N* A
  6. RewriteRule (.*) https://<span style="color: rgb(0, 0, 0);">tuyuanma.com</span>/$1 [R=301,NC,L]6 S- M# O$ G4 ~4 @) X3 D
  7. RewriteCond %{REQUEST_FILENAME} !-f
    . ?& M( i1 m- n5 ~5 m
  8. RewriteCond %{REQUEST_FILENAME} !-d6 k9 j& ~) y' N
  9. RewriteBase /
    6 z/ B- A: I" g) |6 u5 Z
  10. RewriteRule ^(.*)$ /index.php/$1 [L]
复制代码
$ H. U8 K0 C  S1 v
( Z3 u  k7 t0 r9 F! h) y

全部评论 0

您需要登录后才可以回帖 立即登录
登录
0
0
0
返回顶部