Home > Mobile >  How do i make a simple RewriteRule?
How do i make a simple RewriteRule?

Time:09-28

Good day guys, im trying to do some friendly url, i have this url:

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

And .htaccess code:

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


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

With .htaccess i want the next url:

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

CodePudding user response:

You can use the following htaccess code :

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