kesavan
kesavan

Reputation: 5

How to remove .php extension and add slash with htaccess

I'm trying to put together some .htaccess code that will turn example.com/login.php/register.php into example.com/login/register. I've tried varous approaches, but each hasn't worked quite right, from 500 [server] errors on subfolders to issues with the trailing slash, etc...

Upvotes: 0

Views: 488

Answers (1)

xkeshav
xkeshav

Reputation: 54022

first of all example.com/login.php/register.php is not a valid URL at all, first fix the URL and then

TRY ( this will rewrite /register.php URL into /register )

#mod_rewrite
RewriteEngine on
RewriteBase /[project_root_folder_name]/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^register/?$ register.php [NC]

Upvotes: 1

Related Questions