From the course: PHP for Web Designers

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Making sure internal links still work in an include file

Making sure internal links still work in an include file - PHP Tutorial

From the course: PHP for Web Designers

Start my 1-month free trial

Making sure internal links still work in an include file

We've moved the header, Navigation menu, and footer in this site to server-side includes. And everything works well in pages at the top level of the site. If I go to the Arrangements page, click this link here, Navigation menu. It takes me to the correct page, it's at the top level of the site. So is Build-a-Bouquet and Our Designers, they all work. The problems arise when you go into a sub folder. So let's select Care tips and Caring for orchids. The logo is missing from the header there. It's also missing down here from the footer. Both of them come from server side includes. Now the problem gets even worse when you try to follow a link. Let's click Arrangements. 404, page not found. To discover why this is happening, let's go back and view the page source. And I'll just zoom in so we can see what's happening. The problem is best illustrated by comparing lines 6 and line 13, the links to the images. On line 6, the HREF begins with ../. In other words, it's going up a level before it…

Contents