Lalita Tana Lalita Tana - 3 months ago 9
HTML Question

how can i remove the .php extension from my php page

I'm trying to remove the extension from my PHP page, for an example,

www.mywebsite.com/verification.php
, I want people be able to verify from

www.mywebsite.com/verification


my code:

<?php session_start(); ?>
!DOCTYPE html
html lang="en"
head>

meta http-equiv="Content-Type" content="text/html; charset=UTF-8"

Answer

According to this website:

Change your .htaccess file like this:

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

You can do something similar, with the .html extension, except you change the last line to:

RewriteRule ^([^\.]+)$ $1.html [NC,L]

If you don't have a .htaccess file, do what @Cagy79 said:

You could make a directory /verification/ and put your script in an index.php.

In this way a user can go to www.yoursite/verification/ without the need of adding the index.php part