Page 1 of 1
Changing php extension to html (on a windows server)
Posted: Wed Jan 11, 2006 11:35 am
by Luke
I know there is a way to mask php files to look like html files on apache servers, but is this possible on windows? (Sorry if this is the wrong forum) I just want all the files on my website to read like contactus.html instead of contactus.php. Thanks in advance.
Posted: Wed Jan 11, 2006 3:18 pm
by timvw
What's in a name? Anyway, somewhere in your httpd.conf (or in your iis) settings there is something like:
Code: Select all
AddType application/x-httpd-php .php
Simply change that to .html and restart your webserver. This has the disadvantage that all files that end with .html will be passed to the php engine ...
If you're choosing this way, for whatever reason, you might also want to edit php.ini and disable expose_php etc...
Posted: Wed Jan 11, 2006 3:32 pm
by Luke
I'll have to do that when my server guy comes in... thanks. The reason I want it changed to html is just cuz that's what people are used to seeing, and because there are sites linked to html pages on my site that are now php pages. This would be an easy solution rather than redirecting etc.
Posted: Wed Jan 11, 2006 3:33 pm
by RobertGonzalez
Dude, I have been looking everywhere for the answer to this one. I have seen it done. It has something to do with either the Internet Information Services administrative tool or with MMC, but I can't remember which.
<venting>On a side note, those folks at the ASP.NET forums bite. I posed this question in their IIS forum and they deleted it saying that my question was not related to ASP.NET. What gives. The forum is for IIS?!?!? </venting>
Anyhow, I am still looking. SitePoint doesn't have anything, I haven't found anything on Micro$oft MSDN. I have googled the hell out of this thing and haven't found the answer. But I am determined now beyond my ability to stop, so onward I press. To the finish!
Posted: Wed Jan 11, 2006 3:35 pm
by timvw
From the php
install.txt:
*
If you don't want to perform HTTP Authentication using PHP, you can (and should) skip this step. Under ISAPI Filters, add a new ISAPI filter. Use PHP as the filter name, and supply a path to the php4isapi.dll / php5isapi.dll.
*
Under 'Home Directory', 'Virtual Directory', or 'Directory', do the following:
*
Change the Execute Permissions to 'Scripts only'
*
Click on the 'Configuration' button, and choose the Application Mappings tab. Click Add and set the Executable path to the appropriate ISAPI DLL. An example PHP 5 value is: C:\php\php5isapi.dll Supply .php as the extension. Leave 'Method exclusions' blank, and check the 'Script engine' checkbox. Now, click OK a few times.
*
Stop IIS completely (NET STOP iisadmin)
*
Start IIS again (NET START w3svc)
Posted: Wed Jan 11, 2006 3:58 pm
by RobertGonzalez
I found
this article on Micro$oft's site. I think the terminology is application mapping, which tells IIS what to do with what type of application file extension.
SoftArtisan's website had
a pretty good article also, more toward using .NET to process a selected file extension, but might be helpful as well.
I am tired from my searching. Time to rest. Rest, yes rest I need... (cheap Empire Strikes Back plug - Go Yoda, it's your birthday, Go Yoda...)
Posted: Wed Jan 11, 2006 9:21 pm
by timvw
The solution was in the 4th quote ... Supply .php as the extension... Although it has been a long time i'm pretty sure this has worked for me... But i didn't like iis half as much as apache so i never went any further than a simple experiment...
Posted: Thu Jan 12, 2006 11:27 am
by Luke
timvw wrote:The solution was in the 4th quote ... Supply .php as the extension... Although it has been a long time i'm pretty sure this has worked for me... But i didn't like iis half as much as apache so i never went any further than a simple experiment...
I don't have a choice in the matter... the business I work at runs only microsoft software...
Posted: Thu Jan 12, 2006 11:34 am
by RobertGonzalez
I think you can map HTML files to the PHP engine using the application mapping tool. I am not sure if this would cause conflicts with the server already having an instance of HTML running on IIS or if the newer app map would override the previous. But it can be done, check out my previousy posted articles.