额额额,今天配置一个国外源码需要这个伪静态宝塔面板没带,
不配置这个伪静态会导致源码404错误,
配置了就可以解决这个问题。
laravel伪静态配置 apache环境,修改.htaccess文件
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
nginx环境,可以配XXX.com.conf文件加入 nginx.htaccess文件路径
server {
listen 80;
server_name qx.8g.com;
root "D:/phpstudy_pro/WWW/vhosts/qx.8g.com/public";
location / {
index index.php index.html error/index.html;
error_page 400 /error/400.html;
error_page 403 /error/403.html;
error_page 404 /error/404.html;
error_page 500 /error/500.html;
error_page 501 /error/501.html;
error_page 502 /error/502.html;
error_page 503 /error/503.html;
error_page 504 /error/504.html;
error_page 505 /error/505.html;
error_page 506 /error/506.html;
error_page 507 /error/507.html;
error_page 509 /error/509.html;
error_page 510 /error/510.html;
include D:/phpstudy_pro/WWW/vhosts/qx.8g.com/public/nginx.htaccess;
autoindex off;
}
location ~ .php(.*)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
}
然后在根目录建立 nginx.htaccess 文件,写入如下内容,
try_files $uri $uri/ /exploit/index.php?$query_string;
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
© 版权声明
① 本站资源大多来源于网络收集,如有侵犯,请联系站长进行删除处理。
② 分享目的仅供大家学习与交流,请不要用于商业用途,否则后果自负。
③ 本站提供的源码,模版,插件等其它资源,都不包含技术服务,敬请谅解。
④ 本站资源售价只是赞助,收取费用仅为维持本站日常运营所需。
THE END
暂无评论内容