Web Hosting Forum | Lunarpages


*
Welcome, Guest. Please login or register.
Did you miss your activation email?



Login with username, password and session length
February 09, 2012, 07:58:45 PM

Pages: [1]   Go Down
  Print  
Author Topic: How do I remove extention, ".php", when using php5  (Read 374 times)
bkm66x
Newbie
*
Offline Offline

Posts: 3


WWW
« on: February 22, 2010, 06:59:09 AM »

I have been using the following in a .htaccess file successfully for a while

DirectoryIndex index

<Files index>
SetHandler application/x-httpd-php
</Files>


to force a clean url by removing the ".php" from the url. i.e., www.mysite.com/index/page rather than www.mysite.com/index.php/page.

After enabling PHP5, the following is added to the .htaccess file:

AddHandler application/x-httpd-php5 .php5 .php4 .php .php3 .php2 .phtml
AddType application/x-httpd-php5 .php5 .php4 .php .php3 .php2 .phtml


to force the files with those extensions to run as PHP5. This works, except that the file "index" without the ".php" still runs as PHP4 since the AddHandler and AddType are not triggered.

Does anyone have any suggestions? (Other than adding back the file extension. That would change all of my sites URLs.)

Thanks
Logged
MrPhil
Berserker Poster
*****
Offline Offline

Posts: 5083



« Reply #1 on: February 22, 2010, 01:20:18 PM »

Have you tried
Code:
<Files index>
SetHandler application/x-httpd-php5
</Files>
? That might be worth a try.

An alternative would be to rewrite URLs to invisibly add .php (R=302) and use the normal PHP5 stuff.
Logged

bkm66x
Newbie
*
Offline Offline

Posts: 3


WWW
« Reply #2 on: February 25, 2010, 10:34:59 AM »

I did try

SetHandler application/x-httpd-php5

but it did not work. I will try the rewrite. Thanks
Logged
Pages: [1]   Go Up
  Print  
 
Jump to: