0
How to hide extension from url in PHP?
How to hide .php or .html from address bar from clients' browser?
7 odpowiedzi
+ 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.