gpt4 book ai didi

.htaccess - 将 http 重定向到 https,在子目录中出现问题 404 - 未找到

转载 作者:行者123 更新时间:2023-12-04 07:51:46 25 4
gpt4 key购买 nike

根文件夹中的 htaccess

#<IfModule mod_rewrite.c>
#RewriteEngine On
#Uncomment these two lines If you want to redirect http to https
#RewriteCond %{HTTPS} off
#RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^(.*)$ index.php [L]
#</IfModule>

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^https://3pmix.com/ [NC]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>
子文件夹中的 htaccess
RewriteRule ^classes/.*$ - [F,L]
RewriteCond %{HTTPS} off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{REQUEST_URI} config.php|db.php|functions.php [NC]
RewriteRule .* - [F,L]
通过图像的目录结构
enter image description here

最佳答案

使用您显示的示例,请尝试以下规则文件。还要确保在测试 URL 之前清除浏览器缓存。
拥有如下所示的根 htaccess 规则文件:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^3pmix\.com [NC]
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE]
</IfModule>
并让您的子目录 htaccess 规则文件如下:
RewriteOptions InheritBefore
RewriteEngine ON
RewriteRule ^classes - [NC,F,L]
RewriteRule (?:config\.php|db\.php|functions\.php) - [NC,F,L]
我还在您的 htaccess 文件中修复了标志和正则表达式。

关于.htaccess - 将 http 重定向到 https,在子目录中出现问题 404 - 未找到,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66928641/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com