Removing .php file extension error

General discussions related to php

Moderators: egami, macek, gesf

Post Reply
JTarps
New php-forum User
New php-forum User
Posts: 2
Joined: Thu Mar 01, 2018 12:48 pm

Thu Mar 01, 2018 12:54 pm

I have used my .htaccess to remove the file extension '.php' and was wondering if there is a way to do this but still allow access to folders e.g. http://domain.com/folder/ as when I go to this it obviously thinks anything without an extension adds '.php' on the end.

What I really need is so any file with no extension adds .php on the end and any folder without extension stays the same.

Note. I don't mind not using the .htaccess file to forward files to .php

chorn
php-forum Fan User
php-forum Fan User
Posts: 562
Joined: Fri Apr 01, 2016 2:18 am

Thu Mar 01, 2018 11:43 pm

RewriteCond %{REQUEST_FILENAME} !-d

JTarps
New php-forum User
New php-forum User
Posts: 2
Joined: Thu Mar 01, 2018 12:48 pm

Fri Mar 02, 2018 8:21 am

Ah, Thanks that worked I had it request file rather than directory like this:

RewriteCond %{REQUEST_FILENAME} !-f

Post Reply