.htaccess mod_rewrite - how to exclude addon domai

2019-09-14 00:41发布

my main hosting domain require ssl, so the htaccess transform every url request to https.

but i have on the same hosting another domain, with cpanel dir structure ("public_htmml/addon-domain.com")

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.

notice that

 RewriteCond %{REQUEST_URI} !^/public_html/addon-domain.com/.*$

didnt work.

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>

10x very much! hope anybody can help me.

1条回答
我命由我不由天
2楼-- · 2019-09-14 01:08

How about this which can be placed anywhere above your current rules:

RewriteCond %{HTTP_HOST} ^(www\.)?addon-domain\.com$
RewriteRule ^.*$ '-' [L]
查看更多
登录 后发表回答