Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am new to this. Here is the situation and I'm wondering if someone can suggest the best solution to it:

I have a domain www.mydomain.com where I have a Magento website running, we are in development stage so I did URL forwarding www.mydomain.com to www.mydomain.net and we have an under-construction page on www.mydomain.net because we do not want to show development.

I also have a sub domain beta.mydomain.com which I pointed to www.mydomain.com/index.php which works fine.

But how can I show this without changing the URL in a browser from beta.mydomain.com to www.mydomain.com/index.php? This is in order to show our development to management.

share|improve this question

This will redirect a subdomain to another domain or root domain

 RewriteEngine On
 RewriteCond %{HTTP_HOST} ^yoursubdomain\.yourdomain\.com$ [NC]
 RewriteRule ^(.*) http://www.newdomain.com/$1 [L,R]

if you want to show www.mydomain.com/index.php website content to beta.mydomain.com sub domain or beta.mydomain.com website content to www.mydomain.com/index.php?

Simple change domain content path (folder where you website located) from your hosting panel.

share|improve this answer

If I understood your question correctly, a solution to your problem can be found in this Stack Overflow question. Assuming you're using a single Apache instance for all your sites, you can tell mod_rewrite that you're doing a rewrite instead of a redirect by removing the R flag from the RewriteRule:

# Example of internal redirect
RewriteRule (.+)$ "?url=$1" [L,R=301]

# Example of internal rewrite
RewriteRule (.+)$ "?url=$1" [L]

More info about rewrite vs. redirect in this thread. I believe the fact that you're using different domains (or domain/subdomain) will not be an issue, at least I haven't seen anything in the docs, but I'm not sure. Quote about absolute URLs:

If an absolute URL is specified, mod_rewrite checks to see whether the hostname matches the current host. If it does, the scheme and hostname are stripped out and the resulting path is treated as a URL-path. Otherwise, an external redirect is performed for the given URL. To force an external redirect back to the current host, see the [R] flag below.

Now, if you're using a different Apache instance for each site (or some other configuration - I assumed you're using Apache because of the tag) then I'm afraid I can't help you.

share|improve this answer

Why not use .htaccess and allow only people from your company network (IP's or domain) access to view the website?

share|improve this answer
Developers are on different locations and also works from home. – niku Jun 7 '12 at 16:57
Then what about setting up an htpasswd protected area so they can all login and view the site? – Anagio Jun 7 '12 at 20:34

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.