Redirect without the URL changing

Avatar
  • Answered
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
Avatar
JacobIMH
Hello stepsimon, and thanks for the question. It looks like you might have changed some things since posting this question. I do see a (theblacklemons.htm) page. However this doesn't appear to have a redirection code in it such as a HTML meta refresh to re-direct to a different site which would change the URL. You can use a .htaccess 301 redirect 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:

stephensimon.net/theblacklemons.html

Then technically, you'd just create the content you want displayed into that theblacklemons.html page, upload it to your stephensimon.net 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 [R=301] flag in your .htaccess 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 secret.htm, and wanted it to be accessed in the address bar as:

theblacklemons.com/public.htm

You could use the following .htaccess code:

RewriteEngine On RewriteRule ^public.htm$ /secret.htm [L]

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