.htaccess htaccess将子域和子目录重定向到外部url
我要重定向:.htaccess htaccess将子域和子目录重定向到外部url,.htaccess,redirect,subdomain,subdirectory,external-url,.htaccess,Redirect,Subdomain,Subdirectory,External Url,我要重定向: http://cbpq.luisgustavoventura.com/ 及 http://luisgustavoventura.com/cbpq/ 致: http://cbpq.org.br/ 我试过: RewriteCond %{HTTP_HOST} ^(cbpq\.luisgustavoventura\.com|luisgustavoventura\.com/cbpq)$ [NC] RewriteRule ^(.*) https://www.cbpq.org.br/$1 [L,
http://cbpq.luisgustavoventura.com/
及
http://luisgustavoventura.com/cbpq/
致:
http://cbpq.org.br/
我试过:
RewriteCond %{HTTP_HOST} ^(cbpq\.luisgustavoventura\.com|luisgustavoventura\.com/cbpq)$ [NC]
RewriteRule ^(.*) https://www.cbpq.org.br/$1 [L,R]
但是不起作用
请建议。您无法使用
%{HTTP\u HOST}
变量匹配/cbpq
。最好将这些作为两条单独的规则:
RewriteCond %{HTTP_HOST} ^luisgustavoventura\.com$ [NC]
RewriteRule ^cbpq(/.*)?$ http://www.cbpq.org.br$1 [L,NC,R=302]
RewriteCond %{HTTP_HOST} ^cbpq\.luisgustavoventura\.com$ [NC]
RewriteRule ^(.*)$ http://www.cbpq.org.br/$1 [L,NC,R=302]
无法使用
%{HTTP\u HOST}
变量匹配/cbpq
。最好将这些作为两条单独的规则:
RewriteCond %{HTTP_HOST} ^luisgustavoventura\.com$ [NC]
RewriteRule ^cbpq(/.*)?$ http://www.cbpq.org.br$1 [L,NC,R=302]
RewriteCond %{HTTP_HOST} ^cbpq\.luisgustavoventura\.com$ [NC]
RewriteRule ^(.*)$ http://www.cbpq.org.br/$1 [L,NC,R=302]