Help - Testing New Site

liunx

Guest
Hi -<br /><br />I just got my account set up, and I have FTP'd my index.shtml page up with the rest of the required files in the root directory. <br /><br />I can view the page at <a href="http://xx.x.xxx.xxx/~username/" target="_blank">http://xx.x.xxx.xxx/~username/</a> <br />But, I am having a small problem with the include virtual:<br /><br /><!--#include virtual="/header.html" --><br /><br />Which is used all through my site, and works OK on the current host. (I get the [an error occurred while processing this directive] error) I expected to have some problems after searching around here and seeing similar comments. However, I didn't see any solutions (even short term for testing). If I change the code to:<br /><br /><!--#include virtual="/~username/header.html" --><br /><br />then it works OK. However, I don't want to make these changes to test the site, because it's not really a valid way to make sure everything works OK! Similarly, the CSS file is not getting picked up<br /><br /><link rel="stylesheet" type="text/css" href=http://www.totalchoicehosting.com/forums/lofiversion/index.php/"/mycss.css"><br /><br />For the same reason.<br /><br />Question: Is there any quick setting I can put in a .htaccess file in public_html to temporarily set the document root to <a href="http://xx.x.xxx.xxx/~username/" target="_blank">http://xx.x.xxx.xxx/~username/</a> ??? Or some other method???<br /><br />Thanks<!--content-->
Until your domain is propogated you have to use /~username in the path, because / points to the ip's root, not your site root.<br /><br />Once the domain is propogated, it'll work. As far as I know, there isn't a way around this.<!--content-->
Thanks for your quick reply. I think it probably will be OK.<br /><br />Since I have you on the line, there is one more question: I use some .htaccess files to prohibit directory browsing, etc such as<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->Options -Indexes<!--c2--></div><!--ec2--><br /><br />I can FTP them to my site using WS_FTP, but for some reason I can't see the files any longer. Is this some limitation of WS_FTP, or some setting? I can see them with cpanel OK though.<br /><br />Thanks for any help on this -<!--content-->
Yes, it's ws_ftp, there should be an option to show hidden files (.blah - the period indicates a hidden file) - but I run a mac and can't run ws_ftp to find it for you. =)<!--content-->
<img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/kicking.gif" style="vertical-align:middle" emoid=":dance:" border="0" alt="kicking.gif" /> Welcome to the Family <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/kicking.gif" style="vertical-align:middle" emoid=":dance:" border="0" alt="kicking.gif" /> <br /><br />and your new home!<br /><br />For the include<br /><!--#include virtual="/header.html" --><br /><br />if the header is in the same folder you might try<br /><br /><!--#include virtual="header.html" --><br />with out the leading /<br /><br />You also may want to check out using php includes sometime.<br />You may find php more flexiable, such as passing data to the included file.<br />Like adding additional custom text to the title for each page.<br />Example: in the content page, you put this at the top<br /><br /><?php<br />// add header and additional title<br />$page_title="about"; <br />include $_SERVER['DOCUMENT_ROOT']."/header.php"; <br />// begin main content<br />?><br /><br />then the header can display the title like this<br /><br /><title>My site <?php print("$page_title"); ?></title> <br /><br />anyway, something to consider.<br /><br /><br />We really are like family here.<br />So if you need anything,<br />just ask your new family!<br />We love to help <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><!--content-->
Thanks for the advice on php. That is something I have down to learn next!<br /><br />I did find instructions on WS_FTP, so I'm OK there.<br /><br />Thanks for all the help!<!--content-->
If you really want your site to look the same whether accessed through your domain or your IP address, you can accomplish it with some PHP code. You'll have to either change the file extension of your .html files to .php, or change .htaccess so that PHP inside .html files will be parsed. (Off the top of my head I'm not sure what needs to go in .htaccess for this, but someone more familiar with .htaccess than me must be reading. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />)<br /><br />One easy thing you can do is to use PHP's include statement instead of server-side includes. PHP include takes a system path instead of a URL so your problem is sidestepped. So<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><!-- include virtual="/header.html" --><!--c2--></div><!--ec2--><br />becomes<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><? include "/home/username/public_html/header.html"; ?><!--c2--></div><!--ec2--><br /><br />(It may be possible to do the same thing in a server-side include, and I just don't know how.)<br /><br />Making all of your HTML tags work, not just includes, is a little trickier. On my site, I use a hack like this to detect whether the site is being accessed via the domain name or the IP address / server name:<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><?<br />$base_dir = dirname($_SERVER['PHP_SELF']);<br />if (strstr($base_dir, "~username") == FALSE)<br />    $base_dir = "";    <br />else<br />    $base_dir = "/~username";<br />?><!--c2--></div><!--ec2--><br /><br />For convenience, you can put the above code in a separate file (say, global.php) and then include it at the beginning of all your HTML files like this:<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><? include "/home/username/public_html/global.php"; ?><!--c2--></div><!--ec2--><br /><br />Then, anywhere in your HTML files that you want to refer to the root of your site, use the string <b><?=$base_dir?></b>. So<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><link rel="stylesheet" type="text/css" href=http://www.totalchoicehosting.com/forums/lofiversion/index.php/"/mycss.css"><!--c2--></div><!--ec2--><br />becomes<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><link rel="stylesheet" type="text/css" href=http://www.totalchoicehosting.com/forums/lofiversion/index.php/"<?=$base_dir?>/mycss.css"><!--c2--></div><!--ec2--><br /><br />It's a little rough around the edges, but it works, and it's something you can use even if you don't necessarily understand what all the PHP does yet.<br /><br />Good luck with your site!<!--content-->
Welcome to the family! <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><!--content-->
 
Top