Jump to content

[SOLVED] htaccess - make html extension files to be interpreted with php interpreter


ultrasound0000

Recommended Posts

Hi folks,

 

I recently changed my site from html to php. For SEO purposes (can't lose page rankings by doing 301 redirects), I want to keep all my files as html for the time being.

 

Is there a way to configure Apache to interpret the html pages with the php interpreter? Any idea how this is done, htaccess maybe?

 

Also, any drawbacks to this approach?

Link to comment
Share on other sites

Thanks Souless87 for the info.  I tried your code on my htaccess file but for some reason not getting it to run as PHP.  Am I missing something?  I even removed everything else on my htaccess and left just this line of code but still when I go to an html file that has PHP code in, it doesn't work (browser only displays html).

Link to comment
Share on other sites

@Souless87:  Nevermind, it actually worked with the AddHandler application/x-httpd-php .html code that you provided.  I found out my webhost (dreamhost), was re-writing my htaccess file each time.

 

@PFMaBISmAd:  what is the difference between Addtype and AddHandler in this case?  I got it to work with AddHandler, but just curious

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.