Apache配置
1、在laragon环境的目录C:\laragon\etc\apache2\sites-enabled下
<Directory "C:/laragon/www/wuhan/public/">
AllowOverride All
Require all granted
RewriteEngine On
#RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME}! -d
#RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME}! -f
RewriteRule ^index.html$ info.php
</Directory>2、如果根目录下有html静态页面,则要跳转到html页面需要开启(去掉前面#)
#RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME}! -d
#RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME}! -f3、动态页面中实现跳转
header("HTTP/1.1 301 Moved Permanently");
header("Location:跳转路径");exit;
4、防盗链配置
Nginx配置
1、重写规则并跳转
location / {
root 域名;
index index.html index.htm;
rewrite ^/show/(.*).html$ /show/$1 last;
}
2、nginx防盗链配置