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.


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.

|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.

|improve this answer|||||

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

|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 clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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