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}! -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防盜鏈配置