Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialCharles Franklin
17,535 PointsDeploying site in sub-directory?
Hey everyone... Yes its me again... So I have a domain name setup and I'm working through the projects... I'm in PHP and I have the website on my localhost and it works great without issue. So I thought, what the heck, lets upload it to my personal website and see what happens...
So I use GoDaddy as my hosting service. I know its the WalMart of webhosting but it works for playing around...
So I upload my HTDOCS directory to a sub directory of my main site. So my URL would be www.abc.com/shirts. Well all my CSS disappeared. Links work ok, the shirt images show up, etc... The contact form is dead but I can work on that... Seems like its a simple matter of a slash sign somewhere.. Thats what my gut tells me.. Trouble is I dont know where it should go.. You know like "/" refer to the directory up a level? This seems like its probably the easiest thing to solve but I'm not sure where to start...
Ideas?
3 Answers
Andrew McCormick
17,730 Pointsis it only your css that's missing?
is it on every page?
copy and paste the code from your <head>
so we can see how you are linking to the css.
as long as you are using relative links, then it shouldn't be a problem.
Charles Franklin
17,535 PointsHere is my code from my header file...
<html>
<head>
<title><?php echo $pageTitle; ?></title>
<link rel="stylesheet" href="/css/style.css" type="/text/css">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Oswald:400,700" type="text/css">
<link rel="shortcut icon" href="favicon.ico">
</head>
<body>
<div class="header">
<div class="wrapper">
<h1 class="branding-title"><a href="./">Shirts 4 Mike</a></h1>
<ul class="nav">
<li class="shirts <?php if ($section == "shirts") { echo "on"; } ?>"><a href="shirts.php">Shirts</a></li>
<li class="contact <?php if ($section == "contact") { echo "on"; } ?>"><a href="contact.php">Contact</a></li>
<li class="cart"><a target="paypal" href="https://www.paypal.com/cgi-bin/webscr?cmd=_cart&business=Q6NFNPFRBWR8S&display=1">Shopping Cart</a></li>
</ul>
</div>
</div>
<div id="content">
Andrew McCormick
17,730 Pointsif you have your structure set up the same as the project then you shouldn't have the leading "/" when linking to your css. Even though your header.php file may be in the "inc" sub-folder you are including it in your files that are on the same level as the css folder.
Charles Franklin
17,535 PointsI removed the leading / but that didn't work. So as I look at my file structure, I have my index.html and a css folder in in the root of my homepage. In that css folder I have main.css, normalize.css and responsive.css (all from previous projects). So my address for my homepage is www.chipymunk.com
I uploaded my shirts project to a folder within my root called shirts. So my directory structure goes /shirts/.. and so on. So essentially I should be able to go to www.chipymunk.com/shirts and see my project... But what I get is my shirts page with no styling...
??
Andrew McCormick
17,730 PointsAndrew McCormick
17,730 Pointsedit: I changed title as you are deploying to a sub-directory not a subdomain. A sub-directory is foo.com/bar a subdomain is bar.foo.com . Though you can have a subdomain point to a directory on your site, since you said that your url was www.abc.com/shirts then that would just be in a sub-directory.