-2

Hello actually I have this type of url

https://example.com/cart/index.php
https://example.com/cart/details.php

And I want show this

https://example.com/cart
https://example.com/cart/details

How can i do it using .htaccess?

I really try find on google but nothing help me correctly.

Jay Blanchard
  • 34,243
  • 16
  • 77
  • 119
LorenaKING
  • 53
  • 6

1 Answers1

1

This will remove the .index.php and the .php

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


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