Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of web.config and .htaccess configuration

2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you the example analysis of web.config and .htaccess configuration, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Xml

ForceHTTPS

BrowserCaching

# Enables browser cachingExpiresActive OnExpiresByType 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"

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} [Lmaine Renew301]

# 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} [Lmaine Renew301]

PreventAccessToConfigFiles

# Denies access to all .htaccess files

Order Allow,Deny

Deny from all

Satisfy all

UrlRewrite

RewriteEngine On

RewriteCond% {REQUEST_FILENAME}!-f

RewriteCond% {REQUEST_FILENAME}!-d

RewriteRule ^ index.php [QSA,L]

The above is all the content of the article "sample Analysis of web.config and .htaccess configuration". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report