web.co nfig(IIS)と.httaccess(Apache)の構成


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>
customErrror Pages
皬Sets up custom error pages for 4 xx and 5 xx errors
Error Dcument 403/custom-433.
Error Dcument 404/custom-454.
forceHTTPS
RewriteEngine On
RewriteCond%{HTTPS}off
〹First rewrite to HTTPS:
〹Don't put www.here.If it is already there it will be includ,if not
落the subsequent rule will catch it.
RewriteRule.*https://%{HTTP_]HOST%{REQUEST_]URI'[L,R=301]
ヽoo.net.org Now,rewrite any request to the wrong doman to use www.
ヽoo[NC]is a case-innsensitive match
RewriteCond%{HTTP_]HOST^www\.[NC]
RewriteRule.*https://www.%{HTTP_}HOST%{REQUEST_]URI'[L,R=301]
preventAccess ToConfigFiles
璝Denies access to all.httaccess files
<Files~“^.*.([Hh][Tt][Aa])”
Order Allow、Deny
Deny from all
Satisfy all

urlRewrite
RewriteEngine On
RewriteCond%{REQUEST_]FILENAME-f
RewriteCond%{REQUEST_]FILENAME-d
RewriteRule^index.php[QSA,L]
はい、この文章を紹介します。必要な友達は勉強してもいいです。