How to redirect subdirectory to new domain with masking?

1.6k views Asked by At

I have a URL with a subdirectory that I want to forward to a different domain I was able to achieve this by adding:

Options +FollowSymLinks RewriteEngine On Redirect 301 /youthinc http://rbcrftk.com/

Where /youthinc is my subdirectory domain and rbcftk is the domain where the site is hosted. This forwards the subdirectory however it doesn't mask the rbcrftk.com domain. How would I be able to achieve this with masking?

2

There are 2 answers

2
sourabh devpura On

Simple you should create a new default page in this subdirectory like index.html or index.php or index.aspx as per your server and put redirect script in this page . i hop this will help you

2
Panama Jack On

You are confusing Mod-alias with Mod-rewrite. You have the RewriteEngine but then using a mod-alias directive. Also you can not Mask a URL using a 301 redirect. That is what a redirect is supposed to do. The only way you can Mask a domain the way you are trying it is by using mod-proxy with Rewrite. If you use it in htaccess you will need to use the P flag. Mod-proxy has to also be enabled. This will keep the domain from changing.

Options +FollowSymLinks 
RewriteEngine On 
RewriteRule ^youthinc/?$ http://rbcrftk.com/ [P]

http://httpd.apache.org/docs/2.4/rewrite/proxy.html