我如何制作一个简单的 RewriteRule?

How do i make a simple RewriteRule?

大家好,我想做一些友好的事情 url,我有这个 url:

https://example.com/folder/file.php

和 .htaccess 代码:

RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ .php [NC,L]


Options +FollowSymLinks
RewriteRule ^registros/entradas/?$ frmEntradas.php?

有了 .htaccess 我想要下一个 url:

https://example.com/folder/anything/anything

您可以使用以下 htaccess 代码:

RewriteEngine On
Options +FollowSymLinks
RewriteRule ^registros/entradas/?(.*)$ frmEntradas.php? [L]
#rewrite /file to file.php
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^([^\.]+)$ .php [NC,L]
#rewrite /folder/foobar to /folder/file.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^folder/.* /folder/file.php [L]