简体   繁体   中英

Redirect from an https sub-directory to a separate https domain

I'm trying to do the following... either through an apache 2 conf directive or .htaccess.

Two sites: 1) www.myfirstsite.com 2) www.my99thsite.com

I want to redirect in the following way and I'm not sure exactly what needs to happen with certs and redirects:

When a user visits https://www.myfirstsite.com/mysubdir I want to redirect him to https://www.my99thsite.com .

mysubdir is just an empty directory.

Thanks-

-KR

Try this

RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^([^\.]+[^/]) https://www.my99thsite.com [R]

This will check whether the directory is exist. If it will redirect to https://www.my99thsite.com . This should be in your www.myfirstsite.com .htaccess

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM