0

I have few files whose extension is htm that i want to run as php using htaccess code

this is the htaccess code that i am using

AddHandler application/x-httpd-php5 .htm .php .html

this code work fine but now i change my hosting server in that this code not working.

i tried all these code but no one work

AddHandler application/x-httpd-php .htm .php .html

AddType application/x-httpd-php .html .htm

AddType application/x-httpd-php5 .html .htm

my new server says

cPanel Linux Hosting packages only support the SymLinksIfOwnerMatch option in the .htaccess file.

Please point me in right direction how can i run htm file as php on my server

user3262732
  • 240
  • 1
  • 4
  • 15

1 Answers1

1

I'm afraid it's a no-go then... If your hosting blocks the appropriate directives in your .htaccess, your only way to go would be to either blackmail or hack the provider, or change the extension from .htm to .php. As this is really a server-administration thing, and if the server administrator doesn't allow you, there is no way you can go around it...

A hacky solution would be to use rewrites to route .htm to .php files. But still then you'd need to rename your files from .htm to .php. This could be a solution if you're app routing isn't setup dynamically and your main concern is that the url's should not be changed. Although changed url's can be caught with 301 redirects.

giorgio
  • 10,111
  • 2
  • 28
  • 41
  • i have whm access also where i create a cpanel account can i change there ? – user3262732 Jan 12 '15 at 10:45
  • Nope, you'll have to use the apache [RewriteRule](http://httpd.apache.org/docs/2.0/misc/rewriteguide.html) directive. But explaining that is outside the scope of this question. I'd advise you to contact your hosting provider and ask them if they have a solution for executing .htm(l) files as php scripts. It'll save you a lot of time ;) – giorgio Jan 12 '15 at 13:48