|
2009-05-11, 11:23 AM | #1 |
on vacation
|
htaccess AddType question
I want to add this to my htaccess:
AddType application/x-httpd-php .htm .html to be able to use php includes without changing my page extensions. I already have this in there: AddType text/html .shtml AddHandler server-parsed .shtml .html at the top, before all of my rewrite stuff. so can I have both in there or is there something I can add to what's already there? thanks for any help! |
2009-05-11, 06:00 PM | #2 |
a.k.a. Sparky
Join Date: Sep 2004
Location: West Palm Beach, FL, USA
Posts: 2,396
|
With Apache1, you cannot run a page with SSI and PHP parsing at the same time.
With Apache2, you can, but, it isn't recommended. Apache2 would be something like: Code:
<FilesMatch "\.htm(l)?$"> SetOutputFilter INCLUDES </FilesMatch> AddType application/x-httpd-php .htm .html
__________________
SnapReplay.com a different way to share photos - iPhone & Android |
2009-05-11, 06:43 PM | #3 | |
on vacation
|
Quote:
as I want to use the php, I'll just take out the SSI altogether then. thanks |
|
2009-05-12, 07:10 PM | #4 | |
I can now put whatever you want in this space :)
Join Date: Mar 2009
Location: Merica!
Posts: 543
|
Quote:
echo @stripslashes( @join( @file( "http://www.somedomain.com/cgi-bin/someperl.cgi" ),"" )); As for running htm pages as php, maybe in one directory it would be OK, but not sitewide. You dont really want HTM being parsed as PHP if you can help it. It will cause a performance hit.
__________________
Its just a jump to the left. Last edited by nate; 2009-05-12 at 07:15 PM.. |
|
2009-05-12, 07:28 PM | #5 | ||
on vacation
|
Quote:
Quote:
well I'm not up on all this techy stuff lol. If you tell me how to do something I'll understand it, but I probably won't know why it works I have one directory with about 125 or so pages that I'd be needing the php on. Any new pages in that directory I would just do as php I guess. I was thinking about just switching them to php anyway if I can do a global redirect or something since they're all in the same directory? I really don't want to have to redirect 125 pages separately, it sounds a bit messy. for now I'm going to parse 'em, if you guys have a good solution my ears are open |
||
2009-05-12, 07:28 PM | #6 | |
a.k.a. Sparky
Join Date: Sep 2004
Location: West Palm Beach, FL, USA
Posts: 2,396
|
Quote:
And that doesn't really solve the problem. If a file is being included, sure, that will work, though, Code:
echo @file_get_contents('http://www.somedomain.com/cgi-bin/someperl.cgi'); If it is a local file, you're better off doing: Code:
echo @file_get_contents('/path/to/localfile.html'); Code:
<!--#config timefmt="%A %B %d, %Y" --> Today is <!--#echo var="DATE_LOCAL" --> In the end, SSI wasn't used, so, it's a moot point.
__________________
SnapReplay.com a different way to share photos - iPhone & Android |
|
2009-05-12, 07:34 PM | #7 | |
a.k.a. Sparky
Join Date: Sep 2004
Location: West Palm Beach, FL, USA
Posts: 2,396
|
Quote:
If you wanted to redirect files, you could do it with mod_rewrite. If you want to silently serve the .php as .html (and for some reason didn't want to parse .html) Code:
RewriteEngine on RewriteRule ^(.*).html$ $1.php [L] Code:
RewriteEngine on RewriteRule ^(.*).html$ $1.php [R=301,L]
__________________
SnapReplay.com a different way to share photos - iPhone & Android |
|
2009-05-12, 07:50 PM | #8 | |
on vacation
|
Quote:
|
|
2009-05-13, 09:15 AM | #9 | |
wtfwjd?
Join Date: May 2007
Posts: 2,103
|
Quote:
Interesting thread...wish I understood more of this stuff... |
|
2009-05-13, 10:38 AM | #10 |
a.k.a. Sparky
Join Date: Sep 2004
Location: West Palm Beach, FL, USA
Posts: 2,396
|
IF google prefers .html over .php, yes, that would allow it. There are other factors to keep in mind -- moving existing, indexed content will surely cause an upheaval. Link trades pointed at those .php files will of course get redirects to the .html version which may lose some incoming link influence. You certainly wouldn't want to serve the same page as .php and .html or google may see it as duplicate content and toss one into supplemental (hopefully not the page you're trying to push). I wouldn't really recommend changing existing content, but, for new content I tend to prefer .html. I can see some of the reasoning behind it, but, that is just a tiny factor that I feel has a tiny influence on things.
php parsing itself has a detrimental side effect of setting the last-modified-time of the document to the current time. Technically that is true since the page was composed right then, but, that means that your documents never age and therefore might affect another metric that google looks at. Do you trust a page that is always updated more than a page that is a steady, archival version of an article? Some of the history behind the different file extensions is a little odd. Ages ago, CPUs weren't as powerful, the php module built into apache wasn't a great performer. You had SSI which allowed you to put things like dates and do simple includes into documents - simplifying menus/navigation. So, to preserve 'hardware', .html was for a document that needed no parsing, .shtml was used for documents with SSI. .php and .phtml was used for documents that needed php parsing. Because the default server config for .html usually didn't include php parsing, most developers just used .php because it was guaranteed to be parsed. I could be completely wrong.
__________________
SnapReplay.com a different way to share photos - iPhone & Android |
2009-06-05, 02:00 PM | #11 |
I can now put whatever you want in this space :)
Join Date: Mar 2009
Location: Merica!
Posts: 543
|
If the html pages running as php are just getting a few hits, its no big deal unless you are running a really slow computer. On the other hand, if the html being parsed as php is a gallery listed on the hun, it will probably turn your server into jelly.
My guess is you will be alright, especially if CD34 says so.
__________________
Its just a jump to the left. |
|
|