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

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

来自版块: 站长杂谈发表于: 2015-8-17 12:30:46
34313
0
如本资源下载地址失效,请点击此处进行反馈
开通本站Svip会员,全站资源免费下

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

直接上分享,你懂的。 443配置(注意把3个服务器证书也改成自己的路径):
  1. <VirtualHost *:443>
    / z) ?( J6 r; l$ R( n, O
  2.             DocumentRoot /data/www/web/web0001/
    ) X1 y- L; W3 R1 ^- K6 @0 r1 c
  3.             ServerName localhost:443
    . e) n2 L: ?. m1 Z" V
  4.             SSLEngine on
    ( [! L$ t6 m) k: c
  5.             SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
    1 l# m+ X6 t' H) P. q# U* |
  6.             SSLCertificateFile /data/limhme.crt: i( n( n" E, N9 l. R, h2 n
  7.             SSLCertificateKeyFile /data/limhme.key
      H& G- ^9 @$ J* z
  8.             SSLCertificateChainFile /data/root_bundle.crt
    0 _- I- x) l, F
  9.             <FilesMatch "\.(cgi|shtml|phtml|php)$">
    ; ~9 T- E& J9 J9 L7 x8 W9 V
  10.                     SSLOptions +StdEnvVars8 U8 K: z5 k  x2 S2 H: D
  11.             </FilesMatch>3 E: Q8 l4 w  t2 e: ?2 }  Y* b
  12.             <Directory /data/www/web/web0001/>
    2 ?9 j4 ?# f5 P* s5 s
  13.                     Order allow,deny3 o" T+ t1 |0 N: \$ h! n$ X
  14.                     Allow from all+ ^+ L( _" l7 M1 R/ f7 x- T
  15.                     Options Indexes FollowSymLinks
    . g3 X- R! ~4 H# R
  16.                     AllowOverride All8 B+ r- q- f$ r: V; M
  17.             </Directory>
    9 N$ p- {- W* y* b3 }8 h4 s
  18.             BrowserMatch ".*MSIE.*" \( X+ }6 _0 ^# _
  19.                     nokeepalive ssl-unclean-shutdown \7 f# W0 k" z2 Z  o* Y
  20.                     downgrade-1.0 force-response-1.0
    / I% H! d3 h5 G* H% p
  21.             ErrorLog logs/dummy-host.example.com-error_log
    7 ^( W1 s) b6 g; v; e; M
  22.             CustomLog logs/dummy-host.example.com-access_log common
    ( C& {4 q7 ~: s
  23. </VirtualHost>
复制代码
80配置:
  1. <VirtualHost *>$ b5 P- U2 n; b$ N2 b$ }9 i6 h
  2.     DocumentRoot /data/www/web/web0001/1 q  h) g/ V& X
  3.     ServerName web00014 f: n3 v+ h9 S3 g/ i
  4.     ServerAlias tuyuanma.com
    . P2 C" I0 j, j; @/ a# _) X
  5.     ServerAlias tuyuanma.com
    + F, U' R# X* v
  6.     <Directory /data/www/web/web0001/>
    9 @5 l1 }0 g; q. e* W- m+ s7 `) f, u
  7.         AllowOverride FileInfo
    * A7 j7 a; I) m& O
  8.     </Directory>  `8 J" A3 e+ H, `0 P' G1 r8 }& {  S
  9. </VirtualHost>
复制代码
Emlog伪静态规则包含 www.tuyuanma.com 重定向tuyuanma.com,http重定向https,搜索引擎自动http不影响收录的.htaccess规则:
& ]5 h* t0 U7 v! ]+ b3 P5 R
  1. RewriteEngine on
    9 [8 b5 Z* Z0 l+ A; Y& w5 ^
  2. RewriteCond %{http_host} ^www.<span style="color: rgb(0, 0, 0);">tuyuanma.com</span> [NC]
    , D0 o7 e$ U# w" i/ B
  3. RewriteRule ^(.*)$ https://<span style="color: rgb(0, 0, 0);">tuyuanma.com</span>/$1 [L,R=301]
    6 ?7 _# e9 N* s6 r" N/ V  m
  4. RewriteCond %{SERVER_PORT} !^443$
    ( K4 ~3 L; i% {
  5. RewriteCond %{HTTP_USER_AGENT} !(baiduspider|soso|bing|sogou|yahoo|sohu-search|yodao|robozilla|msnbot|msie|feedburner) [NC]
    ! q7 f8 b0 K2 ?" i0 |7 L9 L" s
  6. RewriteRule (.*) https://<span style="color: rgb(0, 0, 0);">tuyuanma.com</span>/$1 [R=301,NC,L]
    " Z' O/ @& p$ e; Y! {2 B
  7. RewriteCond %{REQUEST_FILENAME} !-f
    / l* ?& Q! @# {
  8. RewriteCond %{REQUEST_FILENAME} !-d" ~! n0 x) b2 Q0 S) K
  9. RewriteBase /
    8 j# Y. @0 x9 `3 r) \% x) i: b+ n
  10. RewriteRule ^(.*)$ /index.php/$1 [L]
复制代码

- x  x, |; ]) s8 D) G! `- Z$ b% m6 `" v( L! P

全部评论 0

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