SitePoint Sponsor |
|
User Tag List
Results 1 to 4 of 4
-
Jun 11, 2007, 12:13 #1
- Join Date
- Jan 2006
- Location
- Nova Scotia, Canada
- Posts
- 216
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Php include without changing file extension?
Just wondering if there was a way to have a php include without changing the file extension of a webpaage from .html to .php? The site I'm working on has already been established for a very long time, and changing the extension of files will cause utter chaos with backlinks/sitelinks/etc.
I want to implement php includes for the header/footer/etc. so they don't have to update every single webpage when they want to make change. If this is not possible with a php include, is there a way to acheive the same effect using different method?
Thanks!Photoshop Tutorials, Freebies, News, and more!
www.mintyferret.com
-
Jun 11, 2007, 12:30 #2
- Join Date
- Jan 2006
- Posts
- 51
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Technically you can tell apache to treat .html files as PHP, but I don't recommend it. You probably want to use mod_rewrite. One way is to configure mod_rewrite to send all requests to one PHP file (e.g. index.php) with the path requested as a GET parameter. Then include the header, main content (based on the GET parameter), and footer files.
-
Jun 11, 2007, 15:31 #3
If you are including files with "include or require" they can be any file extension and they will be parsed as php files.
Now what I would do is use mod_rewrite to change all the URLs to extension-less and redirect all the old URL to the new ones. (Using redirect 301)
-
Jun 12, 2007, 10:25 #4
- Join Date
- Jan 2006
- Location
- Nova Scotia, Canada
- Posts
- 216
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
thanks for your suggestions guys!
I decided to just go with a sideserver include instead, and chgne the htaccess files to disply .shtml as .html files, it seemed the easiest way.Photoshop Tutorials, Freebies, News, and more!
www.mintyferret.com
Bookmarks