.htaccess remove extension for single file

Is it possible to redirect requests for example.com/testto example.com/test.phpfor a specific file using .htaccess, leaving all other files / extensions intact?

+4
source share
3 answers

You can try: RewriteRule ^test$ /test.php [L]put it above your general redirect, written for the entire URL of the site.

Such as:

RewriteRule ^test$ /test.php [L] --page wise condition 

RewriteRule ^/?$ "http\:\/\/example\.com\/" [R=301,L] -- generic for site

RewriteRule ^(.[^\.]*)$ index.php?$1 [QSA,L] -- generic for site
+3
source

you can use

RewriteEngine On
RewriteRule ^test$ test.php
+2
source

Yes,

All you do is right at the beginning of your .htaccess file.

RewriteRule ^test test.php [L]

[L] means that he will abide by this line and ignore any subsequent lines.

So move all the other urls after that.

0
source

All Articles