主頁 > 知識庫 > web.config(IIS)和.htaccess(Apache)配置

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

熱門標(biāo)簽:北海市地圖標(biāo)注app 湖北ai智能電銷機(jī)器人 AI電銷機(jī)器人 源碼 新科美甲店地圖標(biāo)注 外呼系統(tǒng)打哪顯哪 新邵電銷機(jī)器人企業(yè) 蘭州ai電銷機(jī)器人招商 高德地圖標(biāo)注論壇 江西外呼系統(tǒng)

xml

<?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

<?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

# 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]

好了這篇文章就介紹到這了,需要的朋友可以學(xué)習(xí)一下。

標(biāo)簽:池州 南陽 大理 黔東 自貢 阿克蘇 黃石 海南

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《web.config(IIS)和.htaccess(Apache)配置》,本文關(guān)鍵詞  web.config,IIS,和,.htaccess,Apache,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《web.config(IIS)和.htaccess(Apache)配置》相關(guān)的同類信息!
  • 本頁收集關(guān)于web.config(IIS)和.htaccess(Apache)配置的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章