Changing php extension to html (on a windows server)
Moderator: General Moderators
Changing php extension to html (on a windows server)
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.
What's in a name? Anyway, somewhere in your httpd.conf (or in your iis) settings there is something like:
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...
Code: Select all
AddType application/x-httpd-php .phpIf you're choosing this way, for whatever reason, you might also want to edit php.ini and disable expose_php etc...
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
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!
<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!
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)
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
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...)
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...)
I don't have a choice in the matter... the business I work at runs only microsoft software...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...
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
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.