.htaccess mod_rewrite-如何从重写规则中排除插件域? [英] .htaccess mod_rewrite - how to exclude addon domain from rewrite rule?
问题描述
我的主要托管域需要ssl,因此htaccess会将每个网址请求转换为https.
my main hosting domain require ssl, so the htaccess transform every url request to https.
但是我在同一主机上托管了另一个具有cpanel目录结构的域("public_htmml/addon-domain.com")
but i have on the same hosting another domain, with cpanel dir structure ("public_htmml/addon-domain.com")
我只能配置public_html htaccess.我需要从重写中排除附加域的目录.因此,当用户键入www.addondoamin.com或不输入www时,htaccess将不会执行任何操作. o/w,我遇到很多错误,附加域镜像到主域.
The public_html htaccess is the only I can configure. I need to exclude from the rewrite the directory of the add-on domain. so when a user type www.addondoamin.com or without the www, the htaccess will not do anything. o/w, i get many errors and the addon domain mirror to the main domain.
注意
RewriteCond %{REQUEST_URI} !^/public_html/addon-domain.com/.*$
辛勤工作.
因此,这是htaccess.
So, here is the htaccess.
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteCond %{HTTPS} !=on
RewriteCond %{REQUEST_URI} !promotion
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
非常10倍!希望任何人都能帮助我.
10x very much! hope anybody can help me.
推荐答案
可以将其放置在当前规则之上的任何地方
How about this which can be placed anywhere above your current rules:
RewriteCond %{HTTP_HOST} ^(www\.)?addon-domain\.com$
RewriteRule ^.*$ '-' [L]
这篇关于.htaccess mod_rewrite-如何从重写规则中排除插件域?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!