InMotion Hosting Support Center

How do I redirect an Addon domain to a folder?

Category: How To

2013-09-11 9:03 am EST

Hits: 5,654
I am redirecting to, but want the result to display in the browser. What do I put in the .htaccess file?

You must login before you can ask a follow up question.

You must login before you can submit an answer.

Best answer chosen by User


9,968 Points
2013-09-12 3:01 pm EST
Hello dubosqued,

If you could please clarify a bit what you're exactly trying to accomplish we might be able to steer you in the right direction.
<h2>Setting up an addon domain</h2>
With your example of <strong></strong> being shown in the address bar, but actually pulling the content from <strong></strong> this would be accomplished like John-Paul said by <a href="" target="_blank">setting up an addon domain</a>.

In your example, <strong></strong> would be a <a href="" target="_blank">primary domain name</a>. That means that the files for this domain would be pulled from your account's default document root which would be the <strong>/public_html/</strong> directory located at:

<pre class="code_block" style="width: 500px; white-space: normal; margin-bottom: -30px;">/home/userna5/public_html/</pre>

When you access <strong></strong> in your web-browser, this would allow you to pull up the addon domain's files over the <strong></strong> domain.

However if your end goal is to display that <strong>index.html</strong> file from the <strong>/public_html/site2/</strong> directory, while leaving <strong></strong> as the domain in the address bar, then you'd simply setup <strong></strong> as an addon domain, and make its document root <strong>/home/userna5/public_html/site2/</strong>. You can always <a href="" target="_blank">modify your addon domain's document root</a> as well.

If you can give us an exact use case for what you're trying to do instead of this, we might have another suggestion to offer. But typically this is how having multiple domains on an account functions.
<h2>Using .htaccess RewriteRule to point to different file</h2>
When you start using <strong>.htaccess</strong> and a <strong>RewriteRule</strong> rule , these can not cross domains unless using <strong>mod_proxy</strong> with Apache, but I'm not sure it sounds like that'd work for you, as along with name server domain masking, you can have problems with search engine optimization and display issues on mobile devices , when trying to do things across domains.

You can however point your <strong>RewriteRule</strong> to a different physical location on your account. But the only way I can think of this being used would be the opposite of your request. For instance if you didn't actually have a <strong></strong> site setup with the root of <strong>/public_html/site2/</strong> physically existing on the server, you could use <strong>site3</strong> to point to a file there.

Basically with this you could make it so when people type in <strong></strong> that the address bar stays at the <strong></strong> address. But it's actually pulling the content from <strong>/public_html/site2/index.html</strong>.

<pre class="code_block" style="width: 500px; white-space: normal; margin-bottom: -30px;">RewriteEngine On
RewriteCond %{REQUEST_URI} ^/site3
RewriteRule .* /site2/index.htm [L]</pre>

If you actually have the physical <strong>/site2/</strong> directory on the server, then you'd need to use something like <strong>/site3</strong> in the <strong>ReriteCond</strong>. Because it's a physical directory it would simply load up that directories Index file from Apache, rather than paying attention to your <strong>.htccess</strong> rules.

Anyways I hope this information was helpful and answered your question. If you'd like to give us a bit more specifics of the problem you're trying to solve we can take another look for you.

- Jacob

You must login before you can post a comment about this answer.

Hi Jacob,

thanks for taking the time to answer. Let me use specifics then, since your discussion is a bit over my head. The discussion I saw elsewhere of the rewrite rule left me confused, since I know nothing about whatever language Apache uses.

Our account with InMotion is I have an add-on domain (actually now a parked domain after several chats with Tech Support) called .... Sorry this is all glommed together; how do you make paragraphs here?

I have—for the time being—both a file peelbooks.html in the root directory of, and an identical file called index.html in a subdirectory called peelbooks. I'd like someone typing "" to go to one or the other (preferably the file in the root directory) to get the page with the browser showing "" instead of "" --- Sorry this is all glommed together; how do you make paragraphs here?
48 Points
2013-09-12 6:22 pm EST
<div style="background-color: #FFF; padding-left: 10px;">Hello dubosqued, and thanks for your reply.

So it does sound like you need an <a href="" target="_blank">addon domain</a>, and not a <a href="" target="_blank">parked domain</a>.
<h2>Parked domains</h2>
As an example, you have <strong></strong>. This is your primary domain name, and as such, any parked domains you add to your site will reflect this exact same website content as well.

So if you had <strong>drawbooks.tld</strong> with <strong>.tld</strong> being any other Top Level Domain like <strong>.net</strong>, <strong>.org</strong>, <strong>.us</strong> and so on, you'd add those as parked domains.
<h2>Addon domains</h2>
An addon domain is a separate domain from your primary one, and points to a completely different folder on your hosting account. I've gone ahead and removed <strong></strong> as a parked domain, and added it back as an addon domain. Now anytime you go to that website it's going to pull from your <strong>/public_html/peelbooks/</strong> folder, instead of your root web folder where your primary domain pulls from.
<h2>Image and resources paths</h2>
Now with the way you designed the <strong>index.html</strong> page within the <strong>/peelbooks/</strong> directory, it would throw 404 not found errors for your images and CSS files. So I went ahead and copied over the folders <strong>/public_html/assets/</strong> and <strong>/public_html/images/</strong> over to <strong>/public_html/peelbooks/</strong> so that works as well.

I also re-named your <strong>/public_html/peelbooks/.htaccess</strong> file to <strong>.htaccess-BAK</strong> so it's not active. As the way it was trying to handle redirections was causing it to put <strong></strong> back in the address bar.

It looks like you were able to successfully make paragraphs here in your comment, you just simply hit <strong>Enter</strong> twice to start a new paragraph much like a text editor.

Hope that cleared things up for you. If you had any further questions please let us know!

- Jacob</div>
9,968 Points
2013-09-13 12:27 pm EST
Jacob, thank you so much for doing on so I could follow the example. I spent a fair amount of time on the phone as well with tech support. Turns out I had hotlink blocking on at, which had the predictable result of serving no images for one add-on domain...except that it let another have them with no problem. The same was true with using "../images/" to access images on like sometimes it worked, sometimes it didn't. I finally moved images and assets to individual add-on domain folders, and now all is well....
48 Points
2013-09-13 4:45 pm EST
<div style="background-color: #FFF; padding-left: 10px;">Hello again dubosqued,

You are quite welcome, I wanted to try to explain things as fully as possibly to steer you in the right direction as I know it can get confusing sometimes with so many options.

I'm really glad things are working for you now how you wanted, if you run into any other snags please let us know!

- Jacob</div>
9,968 Points
2013-09-14 7:11 am EST



22,444 Points
2013-09-11 10:00 am EST
Hello dubosqued,

Thank you for your question. The easiest way to accomplish this, is to Addon the domain:, and in the Document root field enter the folder location for:

This will cause the new site to load from that folder.

If you still want to do this using an .htaccess rule, I recommend this article I found via google search.

If you have any further questions, feel free to post them below.
Thank you,


You must login before you can post a comment about this answer.

You misread my question. I am quite familiar with managing redirections. No, the answer is there is no way to do domain masking except through a name server using a URL frame, but the result may not be readable by many moble devices.
48 Points
2013-09-11 1:24 pm EST
Like this Question?

Need more Help?


Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail:
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!