htaccess - 为子域创建例外

时间:2015-11-22 00:05:03

标签: apache .htaccess subdomain

我遇到htaccess子域异常的问题。

我已添加以下代码,为uae.example.it子域创建一个例外,该子域是受密码保护的目录。

RewriteCond %{HTTP_HOST} !uae\.example\.it 

但是我的浏览器没有提示我输入用户名和密码并向我显示:

  

禁   “您无权访问此服务器上的/。此外,a   尝试使用时遇到404 Not Found错误   ErrorDocument来处理请求。“

这是我的整个htaccess文件。我相信这是一个.htaccess相关的问题。有什么建议吗?

Options -Indexes  
IndexIgnore *

RewriteEngine on

#########################################
# RIMUOVO WWW                           #
#########################################

RewriteCond %{HTTP_HOST} !uae\.example\.it
#RewriteCond %{HTTP_HOST} ^example.it$ [NC]
#RewriteRule ^(.*)$ http://example.it/$1 [R=301,L]


#########################################
# REDIRECT A SITO WEB                   #
#########################################

RewriteCond %{REQUEST_URI} !/abc0000/(.*)$
RewriteCond %{REQUEST_URI} !/abc2015/(.*)$
RewriteRule ^(.*)$ /abc2015/$1 [NC,L]


#########################################
# LANG                                  #
#########################################

#RewriteRule ^abc2015/it/(.*) abc2015/$1 [L]
#RewriteRule ^abc2015/en/(.*) abc2015/$1 [L]

#########################################
# SEO FRIENDLY URL                      #
#########################################

#RewriteRule ^abc2015/r-(.*)$ abc2015/index_exec.php?cmd=seo&fn=$1 [NC,L]
#RewriteRule ^abc2015/p-(.*)$ abc2015/$1.php [NC,L]

RewriteRule ^abc2015/en/$ abc2015/index.php [NC,L]
RewriteRule ^abc2015/it/$ abc2015/index.php [NC,L]

RewriteRule ^abc2015/en/our-company$ abc2015/company.php [NC,L]
RewriteRule ^abc2015/it/la-nostra-azienda$ abc2015/company.php [NC,L]

RewriteRule ^abc2015/en/sectors$ abc2015/sectors.php [NC,L]
RewriteRule ^abc2015/it/settori$ abc2015/sectors.php [NC,L]

RewriteRule ^abc2015/en/expertise$ abc2015/expertise.php [NC,L]
RewriteRule ^abc2015/it/competenze$ abc2015/expertise.php [NC,L]

RewriteRule ^abc2015/en/projects/(.*)$ abc2015/projects.php?fn=$1 [NC,L]
RewriteRule ^abc2015/it/progetti/(.*)$ abc2015/projects.php?fn=$1 [NC,L]

RewriteRule ^abc2015/en/project/(.*)$ abc2015/project.php?fn=$1 [NC,L]
RewriteRule ^abc2015/it/progetto/(.*)$ abc2015/project.php?fn=$1 [NC,L]

RewriteRule ^abc2015/en/contacts$ abc2015/contacts.php [NC,L]
RewriteRule ^abc2015/it/contatti$ abc2015/contacts.php [NC,L]

RewriteRule ^abc2015/en/privacy-policy$ abc2015/terms.php [NC,L]
RewriteRule ^abc2015/it/privacy-policy$ abc2015/terms.php [NC,L]

RewriteRule ^abc2015/en/careers$ abc2015/careers.php [NC,L]
RewriteRule ^abc2015/it/lavora-con-noi$ abc2015/careers.php [NC,L]


#########################################
# ERROR PAGES                           #
#########################################

#ErrorDocument 400 /abc2015/error.php?error=400
#ErrorDocument 401 /abc2015/error.php?error=401
#ErrorDocument 403 /abc2015/error.php?error=403
#ErrorDocument 404 /abc2015/error.php?error=404
#ErrorDocument 500 /abc2015/error.php?error=500

###
# SecFilterEngine Off
# SecFilterScanPOST Off
###

1 个答案:

答案 0 :(得分:0)

RewriteCond仅适用于下一个RewriteRule 如果您不希望在开头使用uae.example.it添加其他规则:

RewriteCond %{HTTP_HOST} ^uae\.example\.it$
RewriteRule ^ - [L]

这意味着:什么都不做