CNC.htaccess (PHP)

Guys, hi, everyone. Tell me how to remove the display .php in the address bar via .htaccess. For example there is a page test.ru/post.php?title=News, how to make it look normal? Even if it's just test.ru/post.php, but at the same time, so that all this is displayed normally. Tell me who faced it. I would be very grateful for an article or advice!

Author: w3cwhy, 2021-02-01

1 answers

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) /index.php/$1 [L]

You can try this. As an alternative:

<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]
    RewriteRule (.+) index.php?p=$1 [QSA,L]
</IfModule>
 1
Author: mepihindeveloper, 2021-02-01 16:48:25