M
M
MagmanQ2021-12-15 13:05:24
htaccess
MagmanQ, 2021-12-15 13:05:24

How to set up .htaccess rules for folders and categories?

Good day. I am writing a site in pure PHP, setting up the .htaccess file, in which I have already written the rules in order to remove the .php extension at the end of the file, but this only works for files located in the root directory. The question is how to make this rule remove the .php extension at the end of any file from any subfolder.

RewriteCond %{ENV:REDIRECT_STATUS} !200
RewriteRule ^(\w+)\.php$ /$1 [R=301]
RewriteRule ^(\w+)/?$ /$1.php

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question