0

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?

Peter Jun
  • 1
  • 2
  • What do you mean by "mask", what is the URL you want to see in the address bar? Are both domains running on the same server, do you have configuration access to both? – Pekka Jun 22 '15 at 19:22

2 Answers2

0

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

sourabh devpura
  • 605
  • 8
  • 25
  • Thank you, could you send me an example script? Would this mask the current url? If I redirect wouldn't it show the new website's url? – Peter Jun Jun 22 '15 at 19:32
  • @PeterJun in html use and in PHP use header("Location: http://www.yourwebsite.com/user.php"); and in asp use <% Response.Redirect "http://www.w3schools.com" %> and please accept my answer if you find it's right one – sourabh devpura Jun 22 '15 at 19:34
0

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

Panama Jack
  • 24,158
  • 10
  • 63
  • 95
  • I tried adding the code but I just get a Not Found The requested URL /youthinc was not found on this server. My current host is godaddy, is their Mod-proxy usually disabled on default? – Peter Jun Jun 22 '15 at 19:52
  • I don't know, that is something you'd have to check with them. Godaddy is not a good place to host almost anything. – Panama Jack Jun 22 '15 at 20:08