Redirect without changing the address in the address bar

Redirect is the process of transferring the url address to another address. For example, you can type but when you hit enter, the page that appears is a page on

The transfer of the above can be done in various ways, eg by javascript:

<script type="text/javascript">

If the script above is placed on index.html in, then the page displayed in the browser will be replaced with the contents of

Biside the replacement of the display in the browser, the address displayed in the address bar will also be replaced with a new address. There are times when things like this are desirable. But in other cases, we may not want visitors to our website know that the page displayed is not derived from the address he was typing in the address bar.

Examples which may make sense to do is as follows. That we have multiple domains, say 3 domain. Everything is set up using WordPress CMS. Size of wordpress is approximately 10MB . Thus, you should hire a hosting that size should be larger than 10MB. So at least you should use a hosting with a capacity of 50M for example. Capacity is usually defined in certain sizes. So even if coupled with the size of the database to its contents need only 15MB, but this size may be not available.

Without the redirection, you have to hire 3 x hosting 50MB even though you only need 3 x 15MB. But with the redirection, you just need to hire a hosting with a capacity of 50MB, while the other two simply by the size of not more than 10KB. There are some providers that provide the very small capacity with a very low cost, so that we can think of for free. This service is usually given to people who already have a domain, but have not had time to build it. So he only need to show such as “Under construction”, which of course is very small in size.

With the redirect technique, we can use this facility to our other two domains.

So how to set it?

First, on the hosting with 50MB capacity, we make a subdomain. For example a domain name for hosting it is , then we can create two subdomains like and Subdomains is just a subdomain alias for . Most hosting providers provide this facility. So can be achieved by and too.

For what we are creating a subdomain, but pointed to himself?

As already mentioned above, the CMS we use is WordPress. Therefore, edit the file wp-config.php in the assigment of $table_prefix. Normally this variable is filled with $table_prefix=’wp_’;

Make changes so that it becomes:

else $table_prefix='ss_';

Thus, although,, also, pointing to the same place, but the page displayed will be different because it uses a different table.

After setting the wp-config.php, the next step is to login to wp-admin of the three domains are, come as , as, and as

To login as , of course, do the settings for the domain itself. As for the and, of course, made ​​arrangements for the two other domains. For example, if will be used for the domain, the settings for also be made ​​in such a way as if we are setting And the most important for this problem is the option-general .

Go to the option-general. In the WordPress address (URL) typically are filled in correctly, however, because we will use this wordpress to, then on the Blog address (URL) we fill it with “http://master “. In this way, any links that are created by Wordpres will use the address

Do it the same way for

The next step is to fill the hosting for the two other domains that leads each to and We only need three settings.

First, we set the php.ini to allow the reading of another url by adding the line

allow_url_fopen = On

Second, we make the file .htaccess that looks like this:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

Third, we make the file index.php which is like:

$redirx="".$_SERVER['REQUEST_URI'] ;
echo file_get_contents($redirx);

For other domains, just simply replace the become

Well, with this index.php file in the DocumentRoot in the, then when there are people accessing the, the contents are shown taken from And visitors will not realize at all that they see the actual taken from somewhere else.

Good luck.

Did you enjoy this post? Why not leave a comment below and continue the conversation, or subscribe to my feed and get articles like this delivered automatically to your feed reader.
Please notice that comment or question submitted should match the topic. Otherwise, we will delete that comment or question :!:

Leave a comment

Before making a comment, make sure you have read the previous comments. Do not make the questions have been asked. Note also the links in the article. Take a look at those links before you create the questions, as it may be an explanation of your questions have been answered in that link.

Comments that do not follow these rules will be deleted!



Time limit is exhausted. Please reload the CAPTCHA.