Help - Search - Members - Calendar
Full Version: Php Includes In Folder Indexes.
Zymic Webmaster Forums > Web Design & Development > Server Side Scripting > PHP
susa007
Well In my public_html folder I have a header php file and a footer php file.

In my index page I use php inlcudes to include my files.

My question is when i make a new folder how can i put includes into the index of the folder. Becaue I want to have sitename.com/contact instead of sitename.com/contact.php

The only way that worked for me was in the include for the url i put

/home/mysite/mypath/*.php and in the stylsheet in header php i had to
put the stylesheet url as http://sitename.com/style.css.

So i was just wondering if there were any better ways to work around it.

O and dont want to put the php files in each folder because that would defeat the purpose of includes.
Andrew
Read up on mod_rewrite

It does what you want to do MUCH more easily.
swordz
mod_rewrite is quite complicated, but VERY powerful - it's worth investing the time.

swordz
Andrew
Heh Swordz is right, it is complicated but once you understand it, it can do what you want more easily than making new folders for just one index file, and worry about weather the images and style sheets will load.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.