.htaccess强制https、www、防盗链

寻技术 Apache / R语言 2023年07月08日 137
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


关闭

用微信“扫一扫”