Apache配置
1、在laragon环境的目录C:\laragon\etc\apache2\sites-enabled下
AllowOverride All Require all granted RewriteEngine On #RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME}! -d #RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME}! -f RewriteRule ^index.html$ info.php 复制代码
2、如果根目录下有html静态页面,则要跳转到html页面需要开启(去掉前面#)
#RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME}! -d #RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME}! -f复制代码
3、动态页面中实现跳转
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防盗链配置