Title: php include outside header file
Last modified: August 19, 2016

---

# php include outside header file

 *  Resolved [chowpay](https://wordpress.org/support/users/chowpay/)
 * (@chowpay)
 * [18 years, 2 months ago](https://wordpress.org/support/topic/php-include-outside-header-file/)
 * Having a bit of trouble with this…
 * So in my theme I want to integrate this site into an existing site. therefore
   using the main site’s header on my blog page . here is the structure
 * website.com/blog/ <– the wp install
    website.com/header2.php <– the location 
   of the header file i want to use , its 1 directory up from the blog
 * I’ve tried adding this <?php include(‘../header2.php’);?>
    into website.com\blog\
   wp-content\themes\MyCustomTheme\header.php
 * It DOES indeed include the file but ALL the images in that header2.php file do
   not work. Its trying to pull the images from:
 * [http://www.website.com/blog/images/myimage.gif](http://www.website.com/blog/images/myimage.gif)
   
   it SHOULD be pulling it from
 * [http://www.website.com/images/myimage.gif](http://www.website.com/images/myimage.gif)
 * I tried searching and couldn’t find a solution and I dont want to resort to iframing
   it if I dont have to.

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Moderator [Dion Hulse](https://wordpress.org/support/users/dd32/)
 * (@dd32)
 * Meta Developer
 * [18 years, 2 months ago](https://wordpress.org/support/topic/php-include-outside-header-file/#post-723909)
 * The simplest way is to modify the header to reference images absolutely.
 * So instead of:
    `<img src="images/myimage.gif" />` You’d use: `<img src="/images/
   myimage.gif" />`
 * That way it knows that its got to search for the file from the base of the HTTP
   site rather than from the current folder..
 *  Thread Starter [chowpay](https://wordpress.org/support/users/chowpay/)
 * (@chowpay)
 * [18 years, 2 months ago](https://wordpress.org/support/topic/php-include-outside-header-file/#post-723911)
 * ok i will give this a shot
 *  Thread Starter [chowpay](https://wordpress.org/support/users/chowpay/)
 * (@chowpay)
 * [18 years, 2 months ago](https://wordpress.org/support/topic/php-include-outside-header-file/#post-723913)
 * actually that wouldnt work because now it works for WP but it doesnt work for
   [http://www.website.com](http://www.website.com) because now its looking for 
   [http://www.website.com//images/myimage.gif](http://www.website.com//images/myimage.gif)
 * There’s no way to properly include the file? some way to exclude WP from marking
   up the links?
 * thanks
 *  Thread Starter [chowpay](https://wordpress.org/support/users/chowpay/)
 * (@chowpay)
 * [18 years, 2 months ago](https://wordpress.org/support/topic/php-include-outside-header-file/#post-724124)
 * bump
 *  [rob0210](https://wordpress.org/support/users/rob0210/)
 * (@rob0210)
 * [18 years, 2 months ago](https://wordpress.org/support/topic/php-include-outside-header-file/#post-724141)
 * It may be easier if you swap the process around. Copy all the info on your header2.
   php and save it in the wordpress header.php file. then let wordpress do its thing!
 *  Thread Starter [chowpay](https://wordpress.org/support/users/chowpay/)
 * (@chowpay)
 * [18 years ago](https://wordpress.org/support/topic/php-include-outside-header-file/#post-724444)
 * thanks man,
 * I think I figured it out, since the site is not all wordpress I had to hack around
   a little to get it to work But I hard hard linked the header. Not the most eloquent
   way to do things but It’ll work for now. Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘php include outside header file’ is closed to new replies.

## Tags

 * [php include](https://wordpress.org/support/topic-tag/php-include/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 6 replies
 * 3 participants
 * Last reply from: [chowpay](https://wordpress.org/support/users/chowpay/)
 * Last activity: [18 years ago](https://wordpress.org/support/topic/php-include-outside-header-file/#post-724444)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
