WebFaction
Community site: login faq

I've created a static app to redirect a new domain to a url of an existing django app using these directions:

http://docs.webfaction.com/software/static.html#redirect-a-domain-with-a-static-cgi-php-app

And it works, HOWEVER, the URL in the browser changes to the django app. I want to keep the new domain in the URL, rather than replace the URL in the browser. Is this possible?

Here is the .htaccess I'm currently using:

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)$ http://www.mydjangoapp.com/something/$1 [R=301,L]

asked 02 Mar '13, 14:35

Jakob
3236
accept rate: 0%

edited 02 Mar '13, 14:42


I found one way to achieve this, just used a 100% frame. Works for me!

<html>
<head>
<title>TITLE</title>
<frameset cols = "100%">
<frame src ="http://www.mydjangoapp.com/something/" />
</frameset>
</head>
<body>
</body>
</html>

Found this solution here:
http://www.resellerspanel.com/shared-web-hosting/articles/domains-subdomains/redirecting-web-page.html

permanent link

answered 02 Mar '13, 15:55

Jakob
3236
accept rate: 0%

What you really want to do is avoid frames and do this all via .htaccess what you had was close to correct however you want to remove the R=301, bit so it is a rewrite and not a redirect

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)$ http://www.mydjangoapp.com/something/$1 [L]
permanent link

answered 02 Mar '13, 23:31

bitspill
31410
accept rate: 0%

Hi, thanks for the answer. I tried this solution with the R=301 removed but my browser redirected showing the new URL. Not sure if I did something wrong, but it was definitely reading the .htaccess since it redirected instead of showing the index.html with the frame I had.

(03 Mar '13, 07:55) Jakob

You need to set up a reverse proxy, it is possible but you have to build your own apache server which does only this. The shared apache server does not provide the directives required to set up a reverse proxy.

permanent link

answered 02 Mar '13, 23:45

johns
5.4k312
accept rate: 23%

edited 02 Mar '13, 23:45

That would be if he was changing the entire domain, correct? (never heard of a reverse proxy before, google'ing)

But I think my solution would work in the case of redirecting

http://www.mydjangoapp.com/SomeAwesomePage to http://www.mydjangoapp.com/something/SomeAwesomePage

(03 Mar '13, 00:39) bitspill

If you are just redirecting the URI and not the entire domain than you should be able to do it with a rewrite in Apache.

(03 Mar '13, 00:56) johns
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×128
×76

question asked: 02 Mar '13, 14:35

question was seen: 33,392 times

last updated: 03 Mar '13, 07:55

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2020 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM