Redirecting a domain to another using Rewrite rules

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I need to forward a domain www.wiki-translation.com to a different location wiki-translation.wiki4us.com, while preserving the original url. 

I have been trying to do this for 30 mins now, using Rewrite rules, and nothing works.

For example, thje Parked domains CPanel functionality created the following lines in my .htaccess file:

---
RewriteCond %{HTTP_HOST} ^wiki\-translation\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.wiki\-translation\.com$
RewriteRule ^/?$ "http\:\/\/wiki\-translation\.wiki4us\.com\/" [R=301,L]
---

This works somewhat, in the sense that it redirects www.wiki-translation.com to wiki-translation.wiki4us.com. But it does not preserve the original URL.

I also tried this replacing the R flag with a P (proxy) flag:

---
RewriteCond %{HTTP_HOST} ^wiki\-translation\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.wiki\-translation\.com$
RewriteRule ^/?$ "http\:\/\/wiki\-translation\.wiki4us\.com\/" [R=301,L]
---

But it yields the error:

---
Proxy Error
The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request GET /.
Reason: DNS lookup failure for: wiki-translation.wiki4us.com
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
---

Then I tried this 

---
RewriteCond %{HTTP_HOST} ^wiki\-translation\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.wiki\-translation\.com$
RewriteRule ^/?$ "http\:\/\/www\.wiki4us\.com\/wiki\-translation\/" [P,L]
---

where www.wiki4us.com/wiki-translation/ is the actual location that the subdomain wiki-translation.wiki4us.com points to.

This one worked kindof. It does point to the right location, and preserves the original url www.wiki-translation.com. But the page comes out looking wrong, presumably because all the CSS files are not accesible as www.wiki4us.com/wiki-translation/*.css (just as wiki-translation.wiki4us.com/*.css). Dunno why.

Any advice you may have will be greatly appreciated.

Thx.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx




[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux