.htaccess
RewriteEngine on RewriteCond %{HTTP_HOST} ^aaa.com [NC] RewriteRule ^(.*)$ https://www.aaa.com/$1 [L,R=301] #将不带www的域名定向到带www的域名,并采用https方式 RewriteCond %{HTTP_HOST} ^bbb.com$ [NC] RewriteRule ^(.*)$ https://www.bbb.com/$1 [L,R=301] #将不带www的域名定向到带www的域名,并采用https方式 RewriteCond %{HTTP_HOST} ^www.bbb.com$ [NC] RewriteCond %{REQUEST_URI} !^/gw/ RewriteRule ^(.*)$ gw/$1 [L,QSA] #将www.bbb.com定向到gw目录 RewriteCond %{SERVER_PORT} !^443$ RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R] 将所有的非443断口定向到https #问题 #帮我写一个.htaccess版本的301重定向文件 #两个域名,aaa.com指向index.php;bbb.com指向/gw/文件夹 #不带www访问时,定向到www.aaa.com; 同理定向到www.bbb.com #http访问时,自动定向到https #上面例子,www.bbb.com定向到了index.php; 而bbb.com却跳转到了https://www.bbb.com/gw/ #不想出现 https://www.bbb.com/gw/
RewriteEngine on RewriteCond %{HTTP_HOST} ^wmdfw.com [NC] RewriteRule ^(.*)$ https://www.wmdfw.com/$1 [L,R=301] RewriteCond %{HTTP_HOST} ^hzdjj.cn$ [NC] RewriteRule ^(.*)$ https://www.hzdjj.cn/$1 [L,R=301] RewriteCond %{HTTP_HOST} ^www.hzdjj.cn$ [NC] RewriteCond %{REQUEST_URI} !^/gw/ RewriteRule ^(.*)$ gw/$1 [L,QSA] RewriteCond %{SERVER_PORT} !^443$ RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R] #####################################