Jump to content

Removing PHP Extension with htaccess


Ricky55

Recommended Posts

Hi

 

Just started to use PHP and I've just uploaded a site that uses some simple includes.

 

I want to remove the PHP extension from my URL / Links as I think they just look better without them.

 

Just looked up how to do it with a .htaccess file and the code I've seen works except on one file.

 

It works for all my files that are all in the root folder of the site, one file though products.php when you click the link the browser adds a / on to the end of the URL.

 

When I've look at the permissions they are different for products.php then they are for all my other files.

 

I've not changed these myself, the only difference between products.php and the others is that products links to other php files where the other files link to other files but through an include.

 

All the files that work have the following permissions

 

Owner 6645

Group 48

Octal 644

 

Products.php has

 

octal 644 but the owner and group are blank.

 

I've tried to change the permissions using Transmit FTP and I just get the following error:

 

Unknown SITE command.

 

The code in the htaccess file is

 

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_FILENAME}\.php -f

RewriteRule ^(.*)$ $1.php

 

What am I doing wrong? / how do I get around this?

 

Thanks in advance

 

Ricky

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.