Addon Domain

Domain Redirect to Subdirectory Without Changing URL: Domain Redirect

The simple way to Domain redirect to subfolder without changing the URL

A)  Domain Redirect and keep everything after the URL

Show all of the same content on one URL as you would another.

For example, if you just changed your domain to DomainB.com, but you still have plenty of visitors coming to DomainA.com, you would use this to show them all of the existing content that is located on the new domain, without the need to update both websites.

You would modify your .htaccess file for the domain that your users will go to, and insert these lines of code:

RewriteCond %{HTTP_HOST} ^DomainA.com
RewriteRule ^(.*) http://DomainB.com/$1 [P]

If you are using the file manager in cPanel, be sure that you have the option to show hidden files selected.

What does the above redirect do?

Adding this line into your .htaccess file, you will be able to go to DomainA.com/YourPage and it will show the content from DomainB.com/YourPage

B) Redirect a domain to a specific URL

If you want visitors to go to DomainA.com with a specific page in mind when doing so, you may use this code:

RewriteCond %{HTTP_HOST} ^DomainA.com
RewriteRule ^(.*) http://DomainB.com/PathToPageHere [P]

For example, you had an external blog such as one on blogspot.com or maybe a shopping cart on etsy.com that you want people to visit your domain without fully hosting the domain there. Now, visitors can access your site using your domain, but see the content of an external URL.

C)  Re-directing an IP address

The following code shows how this can be done in the .htaccess file.

# Redirect all IP address (replace the ## with the IP address numerals) to same http://domain_name.com
RewriteCond %{HTTP_HOST} ^##\.##\.##\.##
RewriteRule (.*) http://domain_name.com/$1 [R=301,L]
Stipulations / Please read

Note: If using the first option, search engines such as Google or Bing will see multiple sites with the same content and can cause ranking drops in one, or both of the sites. From an SEO standpoint, your best option is to create 301 redirects instead.


Mayuresh Vaidya
Mayuresh Vaidya is an electronics and telecommunication engineer having an experience in embedded technology he worked on many technologies such as raspberry pi, Arduino, along IOT home automation devices based on Google and Alexa, also he had good interest in emerging technologies such as IOT, digital marketing, and web related technologies such as hacking and securities.

Recent Posts

The Ultimate Guide to WordPress Maintenance: Tips and Tricks

When you’re running a business that relies on website traffic and sales to succeed. Then you need to keep it…

2 days ago

Migrate In 2024: Our Comprehensive Website Migration Manual to the Next Level

Migration! Yes, this word is very big in the web hosting industry and it has its importance. Especially for businesses…

4 days ago

Unveiling the Importance of Server Maintenance Plans: A Comprehensive Guide

The server is the backbone of the web hosting industry and it acts like a HERO in the web hosting…

2 weeks ago

IP Address is Blocked? A handpicked list of Solutions to Fix it?

Imagine you are on holiday having a cup of tea and browsing your website or blog.Then, what next?You will get…

3 weeks ago

Explained: Difference between Nameservers Vs. DNS

The web hosting industry is growing every minute, day, and year. It has many terminologies that are important to understand…

1 month ago