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

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

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

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

直接上分享,你懂的。 443配置(注意把3个服务器证书也改成自己的路径):
  1. <VirtualHost *:443>
    * l* `  @) g, Z' f8 p
  2.             DocumentRoot /data/www/web/web0001/
    ! Q7 C4 ~$ L1 o% Z$ Q* P, ^: f* R
  3.             ServerName localhost:443
    . y2 F) j& o% n# Q; {; O% ~
  4.             SSLEngine on$ w! J. v' ^. B; {5 _  \5 @1 o, P
  5.             SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
    5 ]0 h: Z7 T# n
  6.             SSLCertificateFile /data/limhme.crt8 N' a! a$ b3 F) o% J) i
  7.             SSLCertificateKeyFile /data/limhme.key
    ' u5 g/ i" g0 E6 M% ~" ~
  8.             SSLCertificateChainFile /data/root_bundle.crt0 Z& L( ?& N0 ~" \! ~! M
  9.             <FilesMatch "\.(cgi|shtml|phtml|php)$">& x& c2 f# j: D
  10.                     SSLOptions +StdEnvVars1 g3 n1 Q, E5 ~
  11.             </FilesMatch>
    / i- n2 W& Q) ~! _: P% ?) D7 E
  12.             <Directory /data/www/web/web0001/>6 I) Z  [2 I+ O" h- Y
  13.                     Order allow,deny
    . _! K& \- g) `+ c1 i& T
  14.                     Allow from all! m2 o2 k( k0 k5 H. j$ `' c% J
  15.                     Options Indexes FollowSymLinks+ Z5 u- T5 Y' N1 z' Z; x$ e8 f8 x
  16.                     AllowOverride All/ d8 A; \8 a! o0 Z3 B- y2 ]7 Z; ~
  17.             </Directory>
    ; v" j7 f# X; f4 E/ ?: x6 i: u
  18.             BrowserMatch ".*MSIE.*" \
    9 T4 H+ P0 _$ W) o7 U4 ~$ X6 p, l! o
  19.                     nokeepalive ssl-unclean-shutdown \, l5 ?* v1 a7 T$ j
  20.                     downgrade-1.0 force-response-1.0
    / |: `$ S, r: F" C
  21.             ErrorLog logs/dummy-host.example.com-error_log) A5 b$ P: a: c& r$ U) c" O
  22.             CustomLog logs/dummy-host.example.com-access_log common
    ( ?% Y, x3 M. o0 m
  23. </VirtualHost>
复制代码
80配置:
  1. <VirtualHost *>
    % L( F8 t; z+ y2 N5 O& D; x0 o
  2.     DocumentRoot /data/www/web/web0001/( ?: k: \0 ~! l# j* z
  3.     ServerName web0001
    0 w' A8 m% @5 E: D
  4.     ServerAlias tuyuanma.com
    ) }- ~) l; w" c2 i9 c
  5.     ServerAlias www.tuyuanma.com/ b* O6 M* A! k' r8 q9 U: K
  6.     <Directory /data/www/web/web0001/># v+ \9 V/ m7 |/ s
  7.         AllowOverride FileInfo
    / d+ k# L% m% ]! ?' j) _
  8.     </Directory>
    * U) O3 H3 t" ?2 ?
  9. </VirtualHost>
复制代码
Emlog伪静态规则包含 www.tuyuanma.com 重定向tuyuanma.com,http重定向https,搜索引擎自动http不影响收录的.htaccess规则:* o9 W) F6 m& @, N, J; \
  1. RewriteEngine on# v; H+ L& H2 i% }  R- l4 t3 n9 j
  2. RewriteCond %{http_host} ^www.<span style="color: rgb(0, 0, 0);">tuyuanma.com</span> [NC]
    0 w! S) E  N/ I) i
  3. RewriteRule ^(.*)$ https://<span style="color: rgb(0, 0, 0);">tuyuanma.com</span>/$1 [L,R=301]
    8 ]$ ?: x7 G* \1 D  _$ b
  4. RewriteCond %{SERVER_PORT} !^443$) N' @% X* R/ P, ^
  5. RewriteCond %{HTTP_USER_AGENT} !(baiduspider|soso|bing|sogou|yahoo|sohu-search|yodao|robozilla|msnbot|msie|feedburner) [NC]: Y/ \  U( b9 P7 ]; |( Z
  6. RewriteRule (.*) https://<span style="color: rgb(0, 0, 0);">tuyuanma.com</span>/$1 [R=301,NC,L]# a; U' }7 @' Q9 U1 B  |/ \4 O* F7 ]
  7. RewriteCond %{REQUEST_FILENAME} !-f! b6 f% o" p5 O, w8 b1 J
  8. RewriteCond %{REQUEST_FILENAME} !-d7 z, @, x* f" v6 y! g
  9. RewriteBase /
    $ T- s: E5 [! D. N6 V* A, @7 a9 o
  10. RewriteRule ^(.*)$ /index.php/$1 [L]
复制代码

. C! D+ t- ~- I
0 w3 v- I, d, g

全部评论 0

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