.htaccess强制https、www、防盗链

服务器   发布日期:2023年05月11日   浏览次数:629
  1. RewriteEngine on
  2.  
  3. #非https访问时强制转https
  4. RewriteCond %{HTTP:From-Https} !^on$ [NC]
  5. RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
  6.  
  7. #非www访问时强制转www
  8. RewriteCond %{HTTP_HOST} !^www\. [NC]
  9. RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
  10.  
  11. #图片防盗链
  12. RewriteCond %{HTTP_REFERER} !^https://19jp.com/.*$ [NC]
  13. RewriteCond %{HTTP_REFERER} !^https://19jp.com$ [NC]
  14. RewriteCond %{HTTP_REFERER} !^https://www.19jp.com/.*$ [NC]
  15. RewriteCond %{HTTP_REFERER} !^https://www.19jp.com$ [NC]
  16. RewriteRule .*\.(gif|jpg|jpeg|png|bmp|swf|mp3|wav|zip|rar)$ https://www.19jp.com/images/logo.gif [R,NC]
  17.  
  18. RewriteRule ^index\.html$ index.php
  19. RewriteRule ^lilei\.html$ show_m.php?place_area=1
  20. RewriteRule ^lilei-([0-9]+)\.html$ show_m.php?place_area=1&page_1=$1&%{QUERY_STRING}
  21. RewriteRule ^shengming\.html$ show_m.php?place_area=2
  22. RewriteRule ^help\.html$ show_m.php?place_area=3
  23. RewriteRule ^contact\.html$ show_m.php?place_area=4
  24. RewriteRule ^jifen\.html$ show_m.php?place_area=5
  25. RewriteRule ^advantage\.html$ show_m.php?place_area=6
  26. RewriteRule ^payment\.html$ show_m.php?place_area=7


以上就是.htaccess强制https、www、防盗链的详细内容,更多关于.htaccess强制https、www、防盗链的资料请关注九品源码其它相关文章!