.htaccess强制https、www、防盗链

服务器   发布日期:2023年05月11日   浏览次数:507
RewriteEngine on

#非https访问时强制转https
RewriteCond %{HTTP:From-Https} !^on$ [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]

#非www访问时强制转www
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]

#图片防盗链
RewriteCond %{HTTP_REFERER} !^https://19jp.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^https://19jp.com$ [NC]
RewriteCond %{HTTP_REFERER} !^https://www.19jp.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^https://www.19jp.com$ [NC]
RewriteRule .*\.(gif|jpg|jpeg|png|bmp|swf|mp3|wav|zip|rar)$ https://www.19jp.com/images/logo.gif [R,NC]

RewriteRule ^index\.html$ index.php
RewriteRule ^lilei\.html$ show_m.php?place_area=1
RewriteRule ^lilei-([0-9]+)\.html$ show_m.php?place_area=1&page_1=$1&%{QUERY_STRING}
RewriteRule ^shengming\.html$ show_m.php?place_area=2
RewriteRule ^help\.html$ show_m.php?place_area=3
RewriteRule ^contact\.html$ show_m.php?place_area=4
RewriteRule ^jifen\.html$ show_m.php?place_area=5
RewriteRule ^advantage\.html$ show_m.php?place_area=6
RewriteRule ^payment\.html$ show_m.php?place_area=7


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