gpt4 book ai didi

web.config(IIS)和.htaccess(Apache)配置

转载 作者:qq735679552 更新时间:2022-09-29 22:32:09 24 4
gpt4 key购买 nike

CFSDN坚持开源创造价值,我们致力于搭建一个资源共享平台,让每一个IT人在这里找到属于你的精彩世界.

这篇CFSDN的博客文章web.config(IIS)和.htaccess(Apache)配置由作者收集整理,如果你对这篇文章有兴趣,记得点赞哟.

xml 。

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<? xml version = "1.0" encoding = "UTF-8" ?>
< configuration >
     < system.webServer >
 
         < httpProtocol >
             < customHeaders >
                 < add name = "Access-Control-Allow-Origin" value = "URL_TO_ALLOW" />
                 < add name = "Access-Control-Allow-Methods" value = "GET,PUT,POST,DELETE,OPTIONS" />
                 < add name = "Access-Control-Allow-Headers" value = "Content-Type" />
             </ customHeaders >
         </ httpProtocol >
 
</ system.webServer >
</ configuration >

forceHTTPS 。

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<? xml version = "1.0" encoding = "UTF-8" ?>
< configuration >
     < system.webServer >
 
         < rewrite >
             < rules >
 
             < rule name = "Force HTTPS" stopProcessing = "true" >
         < match url = "(.*)" />
         < conditions logicalGrouping = "MatchAll" >
         < add input = "{HTTPS}" pattern = "off" ignoreCase = "true" />
         < add input = "{REQUEST_URI}" negate = "true" pattern = "/ADD_PATTERM_TO_EXCLUDE_FILES_OR_FOLDERS/" ignoreCase = "true" />
         </ conditions >
         < action type = "Redirect" url = "https://{HTTP_HOST}/{R:1}" appendQueryString = "true" redirectType = "Permanent" />
             </ rule >
 
             </ rules >
         </ rewrite >
 
</ system.webServer >
</ configuration >

browserCaching 。

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# Enables browser caching
< IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 2 days"
</ IfModule >

customErrorPages 。

# Sets up custom error pages for 4xx and 5xx errors ErrorDocument 403 /custom-403.html ErrorDocument 404 /custom-404.html 。

forceHTTPS 。

RewriteEngine On RewriteCond %{HTTPS} off # First rewrite to HTTPS: # Don't put www. here. If it is already there it will be included, if not # the subsequent rule will catch it. RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] # Now, rewrite any request to the wrong domain to use www. # [NC] is a case-insensitive match RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] 。

preventAccessToConfigFiles 。

# Denies access to all .htaccess files <Files ~ "^.*\.([Hh][Tt][Aa])"> Order Allow,Deny Deny from all Satisfy all </Files> 。

urlRewrite 。

RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^ index.php [QSA,L] 。

好了这篇文章就介绍到这了,需要的朋友可以学习一下.

原文链接:https://blog.csdn.net/WuLex 。

最后此篇关于web.config(IIS)和.htaccess(Apache)配置的文章就讲到这里了,如果你想了解更多关于web.config(IIS)和.htaccess(Apache)配置的内容请搜索CFSDN的文章或继续浏览相关文章,希望大家以后支持我的博客! 。

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