1

How can I rewrite & redirect from:

site.com/folder/login.php to site.com/folder/login/

site.com/folder/profile.php to site.com/folder/profile/

And I also want when I go to login.php, redirect to /login/

I've heared about htaccess, but I'm newbie, can somebody explain how to do this? Thanks in advance

P.S I have site.com/folder/profile.php?logout=true Would be good to rewrite this to site.com/folder/profile/logout/ Thank you.

EvaldasL
  • 105
  • 1
  • 1
  • 6

1 Answers1

1

Hiding .php extension from browser

To hide the .php extension from appearing you should add this inside your .htaccess file!

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

Now, users can access your page by writing domain.com/profile

I hope this helped you. Good luck!

Mr Pro Pop
  • 666
  • 5
  • 19