How can I set the Apache server to hide html source code?

Source: Internet
Author: User
How can I set the Apache server to hide html source code? Http://docs.php.net/manual/zh/intro-whatis.php

You can even set the web server to allow PHP to process all HTML files, so that the user cannot know what the server has done.

Problem:
1.
HTML
 


The above code.
The browser can view the html source code. However, only the php source code results can be seen!

If you do not want the user to know the content of the html source code.
How to configure the Apache server?
PHP official manual (Chinese). how can I explain it?


Reply to discussion (solution)

Do you want to let the user know the html content?

Do you want to let the user know the html content?

"You can even set the web server to allow PHP to process all HTML files, so that users cannot know what the server has done. "

What does this sentence mean?

 


Newbie passing


Do you want to let the user know the html content?

"You can even set the web server to allow PHP to process all HTML files, so that users cannot know what the server has done. "

What does this sentence mean? What the client sees is that the server has explained all the code, that is, html. Do you think users know what the server has done? For example, if you log on, the user will know that you will keep saving his login information?

Change:
1.

//a.htmlHTML
 

The suffix is. html.
The Apache server does not parse the PHP source code.
In addition, the browser will also view the PHP source code.
Yes?

2.
//a.phpHTML
 

The suffix is. php.
The Apache server parses the PHP source code.
In addition, the browser cannot view the PHP source code.
Yes?

3. by default, the Apache server will only parse files with the suffix ". php. Yes?

4. how to change the Apache server configuration. Make the Apache server parse the suffix:. html file?
How can I explain the official PHP Manual (Chinese?

In other words, users do not need to know what the server has done. for example, if you register a website account, you do not need to know what the server has done after you have submitted the form, the server only gives you a feedback: registration is successful or fails. In fact, you don't need server feedback. you can also have this effect, but you don't know if you understand it.

Webpage design:
1. if all the file code is html code. The suffix is: html is the best.
In this way, the Apache server will not parse and directly return to the client browser.

2. if the file code is html and php, or both are php code. The suffix is: php is the best.
In this way, the Apache server parses the PHP code and returns the PHP result to the browser.

In this way, the file suffix is set to reduce the burden on the Apache server. Yes?

What does the browser parse without content?

3. by default, the Apache server will only parse files with the suffix ". php. Yes?

You mean that even access URIs such as: 1.html can be right-clicked on the client and select "View Source File" without the source code rendered by the browser? If so, it is generally set on the client, for example, the simplest way to shield right-click or something.

4. how to change the Apache server configuration. Make the Apache server parse the suffix:. html file?
How can I explain the official PHP Manual (Chinese?

The problems involved here are complicated.

Simply put, html files do not need to be parsed. how to render them is a matter of the browser. If you want to parse html files like php files and parse them according to php syntax, MIME changes are involved. I strongly recommend that you do not do this.

As mentioned in your last post, I don't know what you're thinking ......

Apache parses the php code and submits it to the Apache Module of PHP5. In general, some results will be obtained from the PHP5 parsing module, and the entire file will be transmitted to the browser as html format. That's it.

If you change the suffix directly, the php code will not be parsed, and the desired results will not be available, so it will not be efficient and affordable;

If you change the MIME of an html file to a PHP application, even if your html file is pure html, you must parse it through php and return it as it is, which is less efficient.

In short, I don't know what you're thinking. I hope my answers will help you.

Finally, I want to ask, what is your PHP level? How can I ask a strange question? If you are a newbie, do not ask such a question?

Let me add, read the document. if your English is still good, read the original version ...... (If it is my translation, it is OK ).

You can even configure your web server to process all your HTML files with PHP, and then there's really no way that users can tell what you have up your sleeve.

The configuration mentioned here is the MIME configuration I mentioned. it is strongly not recommended.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.