Can I hide PHP extension in HTML source code

how to remove php extension from url without htaccess
how to hide page name in url in php
how to hide php in url
hide url parameters in address bar php
php hide function
how to hide php code from client
php file extensions
how to hide php code from view source

I know that we can hide PHP extensions on URL bar. Can we hide PHP extensions when the user view source code? For example, in the index.php page (on url bar it is abc.com/index) And I view the source code, the .php extension is still there (in <a> tags). Can I hide it?

If you already have configured your web server to interpret any chosen extension like ".do" as a php script instead of extension ".php", then all your links must use this chosen extension.

So it is not that you "can", it is you "must" use ".do" in your HTML pages.

Hiding PHP - Manual, A few simple techniques can help to hide PHP , possibly slowing down an attacker who is Example #2 Using unknown types for PHP extensions Or hide it as HTML code, which has a slight performance hit because all HTML will be parsed  # Make PHP code look like unknown types AddType application/x-httpd-php .bop .foo .133t Or hide it as HTML code, which has a slight performance hit because all HTML will be parsed through the PHP engine:

If you configured your server (Apache/Nginx) to work with example.com/ and (lets say an about.php) example.com/about, the links would work.

Apache htaccess example config:

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

Thought this is just for php extensions. Though this will only help with links, lets say you are requiring a file you'll still need extensions though that wouldn't show up in element inspector/source code from browser.

<a href="./">Home</a>
<a href="./about">About</a>

How to remove .php, .html, .htm extensions with .htaccess, I stumbled across tutorials on how to remove the .php extension from a PHP page​. In this tutorial I'll show you how to do that easily, by editing the .htaccess file. Desserts; Twitter · Dribbble · GitHub · Flickr the extension of your HTML file from .html or .htm to .php and add the code for removing the .php extension. Hide PHP Extension. To hide the PHP extension from the URL, paste the below code in your .htaccess file. RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^\.]+)$ $1.php [NC,L] Hide HTML Extension. To hide the HTML extension from the URL, paste the below code in your .htaccess file.

The PHP code is not visible on Server side, when you click "View Page Source", however if you submit your URL for optimisation/analystics/SEM companies (bing or google or any other such company), they can get the complete PHP server code. So, it's not foolproof. Even the webpage that you installed on webhost, the PHP code can easily be viewed by the webhost employees itself. So, it's not safe (if your PHP code is critical for you).

To hide your code, you can write your main functionality in Java and port your compiled Java code to the webserver. This way, nobody can decode your code and yet you are able to achieve what you want to do.

how to hide php extension in url using .htaccess, i want to be able to hide php extension in url so that if i got to login it will work the same way as if i was going to login.php. How to add 404 error page when extension restricted .php and .html both for Demos · Hatch Startup Program · Shop Swag · Research Program · Open Source · Code of Conduct. If a page is requested with the .php extension then a new request is made without the .php extension. The .php extension is then no longer shown in the browser's address field. I came up with this solution because none of the many .htaccess suggestions worked for me and it was quicker to implement this in PHP than trying to find out why the .htaccess did not work on my server.

33: How to Remove the Page File Extension From the URL, A common question I get is how to change or hide file extensions html?$ /$1.​php [NC,L] </IfModule>. As written, this code does two things:. By switching the .html to the destination RewriteRule ^(.*)$ $1.html [L] we change the rule to say "If the requested resource name is not a file or directory on disk then try to re-route the request (internally, don't tell the browser) as if it ended in .html".

Hide .php extensions, Custom url for PHP pages with parameters , Don't want to show an ugly PHP file extension or want to hide it away for I have included a zip file with all the example source code at the start of this In the templates folder, we will create the empty HTML page structure. "JavaScript Encryption" This is by far the most popular way to try to hide one's source code. It involves taking your code, using a custom made function to "encrypt" it somehow, and then putting it in an HTML file along with a function that will decrypt it for the browser. A User is able to view the source, however, it isn't understandable.

Hide extension like .html or .php from the URL in normal HTML or , You need to make the extension as .php to run a php code BUT if you can't change the extension you could use Ajax to run the php externally and get the result For eg:

Comments
  • What "PHP extensions" are you talking about? How would they show up in your HTML source? Do you mean "extension" as in /index.php?
  • Please provide a specific example code snippet.
  • @tadman I mean when you redirect your page with <a> tag, you need to type the file name. For example, from index.php to about.php, you write <a href="about.php">. So how can I hide it? ( Hide the extension)
  • Are you using apache?
  • If you don't need to put them in to render the page properly (e.g. URL bar) then you don't need to put them in the source itself either.
  • Thanks a lot, I will have a look
  • Just realized it was answered in comments, pardon excess answer.
  • No problem. Anytime.