1

I recently moved my site to a new host and I now have to include the .php file extension to all php files when navigating them. With my previous host, I was able to get to them either way.

http://example.com/myphpfile.php

or

http://example.com/myphpfile

Can anyone tell me how I can fix this so I don't need the .php extension to navigate to the page?

Thanks!

Jake Sankey
  • 4,977
  • 12
  • 39
  • 53

2 Answers2

0

if you have access to .htaccess

create an .htaccess file in the directory you want to enable this in, and in that file type

SetHandler php-script

that should force all pages to process as PHP for apache

Dave
  • 991
  • 1
  • 7
  • 15
  • for future/similar reference hits on this... `AddHandler php-script .html` will force PHP to process html files – Dave Sep 17 '12 at 18:54
  • This doesnt seem to work. When I added this, it actually downloads the .php file to the users computer. – Jake Sankey Sep 17 '12 at 19:14
0

Solved it I guess. Having this in .htaccess seems to work.

RewriteCond %{REQUEST_FILENAME}.php -f
Jake Sankey
  • 4,977
  • 12
  • 39
  • 53