I have a site that i have got to build, and the folder structure is as follows-
Folder name
index.php
about.php
contact.php
…..etc
Note that all the pages are present in the same directory itself.
Now to the question- How can I make it possible for the URLs of all the pages to not show .php at the end?
for reference-> domain-name.com/about instead of domain-name.com/about.php
and the same for all the pages
i have tried messing around with the htaccess file but if i search for a page without the php extension it loads the index page
So far i have tried using this but to no avail
```
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^.]+)$ $1.php [NC,L]
```
what i need is-
- the php extension should not be visible on the url
- if i search for a page without the php extension the page should work like intended and not lead to index file
Atul Anurag is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.