Ramiro
Ramiro

Reputation: 47

Simple htaccess redirect extension .php

I'm trying to perform this task for my server, but I could not realize how to do it. I need to redirect any url to url.php. For example, to redirect domain.com/about to domain.com\about.php.

I've always used this code, that's working fine for me:

Options +FollowSymLinks
RewriteEngine On
RewriteBase /

RewriteRule ^([^\.]+)$ $1.php [L]

The problem is that I need to do the same for domain.com/api/. In the API folder. I tried changing the script and adding other similar line but it's not working as it should.

Thank you in advance.

Upvotes: 1

Views: 115

Answers (1)

Alvar FinSoft Soome
Alvar FinSoft Soome

Reputation: 740

Change RewriteBase / to RewriteBase /api/ and everything should be fine (api/about.php etc are called out)

Upvotes: 1

Related Questions