InMotion Hosting Support Center

Redirect without the URL changing

Category: Domain Names

stepsimon
Asked:
2013-08-26 11:40 am EST

Hits: 7,472
My page stephensimon.net/theblacklemons.html
redirects to theblacklemons.com. How do I keep the url from changing from theblacklemons.com, to stephensimon.net/theblacklemons.html, when the page is visted.

Thanks

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

You must login before you can submit an answer.

OTHER ANSWERS

0

JacobIMH
9,968 Points
2013-08-26 1:21 pm EST
Hello stepsimon, and thanks for the question.

It looks like you might have changed some things since posting this question. I do see a (<strong>theblacklemons.htm</strong>) page. However this doesn't appear to have a redirection code in it such as a <a href="http://www.inmotionhosting.com/support/edu/website-design/meta-tags-explained/what-are-meta-tags#meta-refresh" target="_blank">HTML meta refresh</a> to re-direct to a different site which would change the URL.

You can use a <a href="http://www.inmotionhosting.com/support/website/how-to/setting-up-a-301-permanent-redirect-via-htaccess" target="_blank">.htaccess 301 redirect</a> to redirect pages as well.

However in your case it would help with a bit of clarity on what your end goal is. As if you wanted the URL to remain in the address bar as:

<p class="code_block" style="width: 270px;">
stephensimon.net/theblacklemons.html
</p>
Then technically, you'd just create the content you want displayed into that <strong>theblacklemons.html</strong> page, upload it to your <strong>stephensimon.net</strong> site, and then don't do any sort of redirection.

You can force the address bar to stay the same and not change by removing the <strong>[R=301]</strong> flag in your <strong>.htaccess</strong> rule, and also not using a full domain name. But that will only work on the same domain. As it's a security problem if you were able to type in one domain name but getting served content from another.

For instance, if you had the page <strong>secret.htm</strong>, and wanted it to be accessed in the address bar as:

<p class="code_block" style="width: 220px;">
theblacklemons.com/public.htm
</p>
You could use the following <strong>.htaccess</strong> code:

<p class="code_block" style="width: 290px;">
RewriteEngine On
RewriteRule ^public.htm$ /secret.htm [L]
</p>
I hope that was clear enough for the problem you're trying to solve, if you had any further questions at all please let us know.

- Jacob


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

Hi Jacob,
Thanks for taking a look at this. Sorry I was not clear. The actual page with the redirect is: stephensimon.net/lemons.html

theblacklemons.com, redirects to: stephensimon.net/lemons.html

So, you put theblacklemons.com in the url, you are taken to stephensimonsimon.net/lemons and now the address in the url box changes to stephensimon.net/lemons.

I would like visitors to enter theblacklemons.com in the url, and have that address remain theblacklemons.com in the url address bar, NOT change to stephensimon.net/lemons

Thanks again. Any help would be appreciated.

stepsimon
14 Points
2013-08-27 10:24 am EST
Hello stepsimon,

Thank you for your comment. It seems you are just trying to host another website, and have it load from a specific folder. You can accomplish this by Adding the domain to your cPanel, then for the document root enter:
public_html/theblacklemons.com

Be sure to allow up to 24 hours for the Addon domain to propagate.

Then delete the existing redirect, and the site will load successfully on the address:
theblacklemons.com

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

-John-Paul
John-Paul
23,489 Points
Staff
2013-08-27 11:00 am EST
Hey there,
So, for document root enter: public_html/theblacklemons.com, get's me a folder in the public_html folder of stephensimon.net called theblacklemons.com. In that folder I have set up an index.html page. Is this the correct way to set up the index page for an add on domain?

Also, I removed the redirect two days ago. Right now when I enter theblacklemons.com in the url, I get a 404, but the url still shows the redirect as active. The 404 is because I have deleted the page that the redirect originally pointed to.

Any help would be appreciated.

Thanks
stepsimon
14 Points
2013-08-30 11:19 am EST
<div style="background-color: #FFF; padding-left: 10px;">Hello stepsimon,

Try to <a href="http://www.inmotionhosting.com/support/website/how-to/clear-browser-cache" target="_blank">clear your web-brower's cache</a>, as it sounds like you probably cached the <strong>.htaccess</strong> rules. Placing a <strong>index.html</strong> file in the document root of your addon domain should force that site to use that as its index page.

Currently I'm not seeing a 404 error when just accessing your addon domain. I also don't see any RewriteRule statements in your <strong>.htaccess</strong> file that should be trying to cause a re-direction.

Please let us know if you're still seeing any issues after clearing your cache.

- Jacob</div>
JacobIMH
9,968 Points
2013-08-30 12:14 pm EST
Worked! Thanks for the help!! Have a great weekend!!!!
stepsimon
14 Points
2013-08-30 1:11 pm EST
<div style="background-color: #FFF; padding-left: 10px;">Hello stepsimon,

Awesome! Glad to hear that worked :)

- Jacob</div>
JacobIMH
9,968 Points
2013-08-30 1:18 pm EST
If redirection is dynamic based on some variable then we can go for i frames as well, if security is not much concern

Check this out:-
http://myutilities.mybluemix.net/utility/73/redirect-without-the-url-changing-in-java-only-possible-way-to-dynamic-redirect-without-the-url-changing-in-java/utility.htm
venu193043@gmail.com
3 Points
2015-05-05 7:11 am EST
Like this Question?

Need more Help?

Search

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: support@InMotionHosting.com
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!