简体   繁体   中英

redirecting url through htaccess by masking it

I have two domains, www.domainA.com and www.domainB.com. I have actual files in domainA.com/files. When a user go to www.domainB.com, he should redirect to www.domainA.com/files. but in address bar it should show www.domainB.com.

I do not know how to do it. Somebody please suggest me how to achieve this.

* EDITED *

I have downloaded proxy script from http://sourceforge.net/projects/phpr0xi/ and did the same think in .htaccess, but it gives me below error. 404 Not Found The server can not find the requested page:

my .htaccess in www.domainB.com.

RewriteEngine on
RewriteRule ^domainb(.*) http://www.domainA.com/domainb$1 [P]

You can try this htaccess redirect , it should generate this code for you for a 302 redirect.

#302 Redirect Entire Old directories
RedirectMatch 302 domainb(.*) http://www.domainA.com/domainb$1

since you want to keep the old domain on the address bar, the 302 redirect code will do the trick

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