-2

The title says it all. This is what it looks like now: This is what it looks like now I'd like to make it look like "psychops.tk/index (I may rename it to "home" to make it better). And same goes for every other page on the website

Hilex23
  • 337
  • 2
  • 11
  • 3
    There are literally thousands of duplicates, going back more than a decade. Googling your *exact title* (["How do I hide the file extension in the URL?"](https://www.google.com/search?q="How+do+I+hide+the+file+extension+in+the+URL%3F")) finds https://stackoverflow.com/questions/6534904/how-can-i-remove-file-extension-from-a-website-address as the first result. Eleven years ago, somebody chided the author of *that* question due to the number of duplicates that already existed. Learning to do some research via Google before asking for help is a critical skill to acquire. – user229044 Dec 04 '21 at 00:29

1 Answers1

0

Create a .htaccess and copy the code below into it. The file should be saved in the root directory of your project.

RewriteEngine On
RewriteCond %{THE_REQUEST} /([^.]+)\.php [NC]
RewriteRule ^ /%1 [NC,L,R]

RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^ %{REQUEST_URI}.php [NC,L]

Now the .php extension will no longer appear on all your PHP files.

tyazeez
  • 335
  • 1
  • 6