简体   繁体   中英

Redirect URL without change domain

I have one server with IP address (say) wxyz , and 2 domains parked on it.

mydomain.com

herdomain.com

I also have 3 file manager (php autoindex free) like this:

mydomain.com/Files/index.php?dir=folder1/folder2/

herdomain.com/myfiles/index.php?dir=mydata/folder2/

now I want to redirect users who open folder2 (from one of the above urls) to this url without changing domain (is it possible)?

w.x.y.z/support/index.php?dir=mainfolder/folder2/

how can I do this on autoindex or .htaccess ?

Thanks

Add this to your .htaccess in web root "/"

RewriteEngine on
RewriteBase /

RewriteCond %{HTTP_HOST} ^(mydomain|heredomain)\.com$ [NC]
RewriteCond %{QUERY_STRING} dir=(folder1|mydata)/folder2/ [NC]
RewriteRule ^(.*)$ http://w.x.y.z/support/index.php?dir=mainfolder/folder2/ [L]

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