question about DNS records and hosting

dannymyung
dannymyung used Ask the Experts™
on
I have a domain that's hosted with Network Solutions. I have a completely separate hosting account through ANHosting with a static ip.

How can I allow NS to continue to control the records, but point the A records to my hosting server, so that when it goes to my static IP it goes to a subfolder where this website will be instead of the root? If that doesn't make sense then I can try to explain it another way.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
You can't do this with DNS, you will have to put a redirect in the root directory to send all traffic to the subdirectory.  Tell me what kind of web server, and I will give you the redirect to use.

Author

Commented:
General server information:
Operating system       Linux
Service Status       Click to View
Kernel version       2.6.18-92.1.22.el5PAE
Machine Type       i686
Apache version       2.2.13 (Unix)
PERL version       5.8.8
Path to PERL       /usr/bin/perl
Path to sendmail       /usr/sbin/sendmail
Installed Perl Modules       Click to View
PHP version       5.2.9
MySQL version       5.0.81-community
cPanel Version       11.24.5-STABLE 38506
Theme       cPanel X v2.6.0
Documentation       Click to View
cPanel Pro       1.0 (RC1)

Commented:
so php should work, use this:

<?php
header( 'Location: /subdirectory' ) ;
?>

Change the word subdirectory above to the name of the subdirectory you want to direct them to.  Only those three lines should be in the file, name it index.php and put it in the root directory of your server.

If that doesn't work, you can use HTML.  Make the same word change, save this one as index.htm or index.html and put it in the root directory.  You can do both if you want, it won't hurt anything.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Page Title</title>
<meta http-equiv="REFRESH" content="0;url="/subdirectory"></HEAD>
<BODY>
Optional page text here.
</BODY>
</HTML>
Acronis in Gartner 2019 MQ for datacenter backup

It is an honor to be featured in Gartner 2019 Magic Quadrant for Datacenter Backup and Recovery Solutions. Gartner’s MQ sets a high standard and earning a place on their grid is a great affirmation that Acronis is delivering on our mission to protect all data, apps, and systems.

Author

Commented:
Thank you. Is there any way I can preserve the original NS domain name when it's forwarded, or will it show up in the address bar as "www.myanhostingdomain.com/subdirectory"?

Commented:
It will probably show up with the subdirectory  at the end.  You should be able to use URL rewrite functionality to rewrite the URL so that the subdirectory does not appear.

http://httpd.apache.org/docs/2.0/misc/rewriteguide.html

Tell me the name of the subdirectory and I will find an example that will work.

Author

Commented:
The full url will be http://www.classiccitycomputing.com/opmarks but I'd like it to say just opmarks.com in the address bar

Author

Commented:
Ah, well see...I tried your index.php method but then it directs all traffic to the subdirectory. I'd like to keep my current website at classiccitycomputing.com when someone types in classiccitycomputing.com, but when someone types opmarks.com they go to opmarks.com which will actually be classiccitycomputing.com/opmarks

is that possible?
Commented:
Make a .htaccess file and paste this into it:

Options +FollowSymLinks

RewriteEngine On
RewriteCond %{HTTP_HOST} www.opsmarks.com
RewriteCond %{REQUEST_URI} !opsmarks/
RewriteRule ^(.*)$ opsmarks/$1 [L]

Author

Commented:
you are awesome, thank you so much

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial