0
How to hide extension from url in PHP?
How to hide .php or .html from address bar from clients' browser?
7 RĂ©ponses
+ 5
//Mike yup php page without extension is not recognized by server and i was slightly wrong with typing, but still html can be used
+ 3
//Using cpanel
//When creating new page create a file without extension 'index', 'home' not like 'index. html', home.html'
+ 2
//Mike so you are new to cpanel
//Try this link i created for test for you with my ninja technique
https://www.ews.org.np/hello
+ 1
One is using a web serverâs default setting, but that only works on the directoryâs index page. With most website hosting acounts, if you go to a website, or a subdirectory in it, without specifying a page, you will be shown index.html, index.php, or whatever index page is the default. You can change the default page with .htaccess.
Another way is to use .htaccess to treat all files without extensions as php, then just donât give the file names extensions.
Another option is to use .htaccess with rewrite rules.
.htaccess is a very useful feature.
0
Just removing a file name extension, as shudarshan said, wonât work. The server wonât know how to treat the file unless something is done in the .htaccess file as I already said.
Correction: Shudarshan Rai is correct when it comes to the html extension. Just donât use an extension. Not using an extension for php is more complicated though. Sorry Shudarshan. I was paying too much attention to the original question asking about html and php extensions. đ
0
Shudarshan Rai Iâve been using cPanel since V3 back in 2001. Your page worked which means something somewhere is treating no extensions as php. Thatâs what I said.
http://premierwebsitesolutions.com/phppage
Try that one. Itâs just going to print out the php because the server doesnât know itâs php without an extension, or being told to treat is as php.
0
We were both right. I should have realised you were only referring to html pages. Html is easy to hide because html is assumed.