作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
如何转换下面的 .htaccess (Apache) 文件以便 NGINX 使用它?
Options -Indexes
Options +FollowSymLinks
# Enable ETag
#FileETag MTime Size
FileETag none
# Set expiration header
ExpiresActive on
ExpiresDefault A2592000
Header append Cache-Control "public"
# Compress some text file types
AddOutputFilterByType DEFLATE text/html text/plain text/css text/xml application/x-javascript text/javascript application/javascript application/json
# Deactivate compression for buggy browsers
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# Set header information for proxies
Header append Vary User-Agent
########################################################
# Rewrite Rules
########################################################
RewriteEngine on
# Require SSL (HTTPS) on the signup page
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} ^/signup/?
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]
# Redirect /signup/plan or /signup/plan/ -> /signup/index.php?account_type=plan
RewriteRule ^signup/([A-Za-z]+)/?$ /signup/index.php?account_type=$1 [NC,L]
# Redirect /home/123 or /home/123/ -> home.php?home_id=123
RewriteRule ^home/([0-9]+)/?$ home.php?home_id=$1 [NC,L]
# Redirect /homes/ in case someone made a typo when it should have been /home/
RewriteRule ^homes/([0-9]+)/?$ home.php?home_id=$1 [NC,L]
#################################################
# Default Settings
#################################################
# hide apache server signaute on apache generated pages (e.g. 404)
ServerSignature Off
最佳答案
关于apache - 如何将 .htaccess 文件转换为 NGINX?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2003972/
我是一名优秀的程序员,十分优秀!