


The functional writing method of .htaccess file in apache - .htaccess file (or "distributed configuration file" provides a method to change the configuration for a directory, that is, placing a file containing one or more instructions in a specific document directory to Applies to this directory and all its subdirectories. As a user, the commands you can use are restricted. Administrators can set it through the Apache AllowOverride directive. Directives in subdirectories will override higher-level directories or main server configurations. directives in the file.
- .htaccess must be uploaded in ASCII mode, preferably with its permissions set to 644.
Location of the error document
Common client request error return codes:
401 Authorization Required
403 Forbidden
404 Not Found
405 Method Not Allowed
408 Request Timed Out
411 Content Length Required
412 Precondition Failed
413 Request Entity Too Long
414 Request URI Too Long
415 Unsupported Media Type
Common server error return codes:
500 Internal Server Error
Users can use .htaccess to specify their own pre-made error reminder page. , people can set up a special directory, such as errors, to place these pages. Then add the following instructions to .htaccess:
ErrorDocument 404 /errors/notfound.html
ErrorDocument 500 /errors/internalerror.html
One command per line. The first command above means that when the required document is not found, the page must be displayed as the notfound.html page in the /errors directory. It is not difficult to see that the syntax format is:
ErrorDocument. Error code/directory name/file name.extension
If there is very little information to be prompted, there is no need to create a special page and use the HTML number directly in the command, such as the following example:
ErrorDocument 401 "
You do not have permission to access this page , please give up!
"Password protection for document access
To use .htaccess to set access users and corresponding passwords for documents in a certain directory, the first thing to do is to generate a. The text document of htpasswd, for example:
zheng:y4E7Ep8e7EYV
The password here is encrypted. Users can find some tools to encrypt the password into the encoding supported by .htaccess. It is best not to place this document in the www directory. It is recommended to place it outside the www root directory document, which is safer.
With the authorized user document, you can add the following instructions to .htaccess:
AuthUserFile .htpasswd server directory
AuthGroupFile /dev/null (directory that requires authorized access)
AuthName EnterPassword
AuthType Basic (authorization type)
require user wsabstract (users allowed to access, if you want all users in the table to be allowed, you can use require valid-user)
Note, the brackets are comments added by yourself during learning
Deny access from a certain IP
If I don’t want a certain government department to access the content of my site, I can exclude them by adding the department’s IP in .htaccess.
For example:
order allow,deny
deny from 210.21.112.43
deny from 219.146.95
allow from all
The second line denies an IP, the third OK to deny a certain IP range, that is, 219.146.95.0~219.146.95.255
Want to deny everyone? Just use deny from all. Not only IP, but also domain name can be used to set it.
Protect .htaccess document
When using .htaccess to password-protect a directory, it contains the path to the password file. For security reasons, it is necessary to protect .htaccess so that others cannot see its contents. Although this can be done in other ways, such as permissions on the document. However, .htaccess itself can also do it, just add the following instructions:
order allow,deny
deny from all
URL redirection
We may redesign the website, move documents, or change the directory. At this time, visits from search engines or links from other websites may go wrong. In this case, you can use the following command to automatically redirect the old URL to the new address:
Redirect /old directory/old document name address of the new document
or redirect the entire directory:
Redirect old Directory New Directory
Change the default homepage file
Generally, the default homepage file names include default, index, etc. However, sometimes there is no default file in the directory, but a specific file name, such as pmwiki.php in pmwiki. In this case, it is troublesome for the user to remember the file name to access it. You can easily set a new default file name in .htaccess:
DirectoryIndex You can also list multiple new default file names
, and the order indicates the priority between them, for example:
DirectoryIndex filename.html index.cgi index.pl default.htm
in a specific document directory

本文给大家介绍如何安装apache2.4,以及如何配置php8.0,文中附有图文详细步骤,下面就带大家一起看看怎么安装配置apache2.4+php8.0吧~

mod_limitipconn,这个是apache的一个非官方模块,根据同一个来源ip进行并发连接控制,bw_mod,它可以根据来源ip进行带宽限制,它们都是apache的第三方模块。1.下载:wgetwget2.安装#tar-zxvfmod_limitipconn-0.22.tar.gz#cdmod_limitipconn-0.22#vimakefile修改:apxs=“/usr/local/apache2/bin/apxs”#这里是自己apache的apxs路径,加载模块或者#/usr/lo

查看apache版本的步骤:1、进入cmd命令窗口;2、使用cd命令切换到Apache的bin目录下,语法“cd bin目录路径”;3、执行“httpd -v”命令来查询版本信息,在输出结果中即可查看apache版本号。

本篇文章给大家带来了关于PHP的相关知识,其中主要跟大家分享在Ubuntu20.04 LTS环境下安装Apache的全过程,并且针对其中可能出现的一些坑也会提供解决方案,感兴趣的朋友下面一起来看一下吧,希望对大家有帮助。

1.Nginx和tomcat的区别nginx常用做静态内容服务和代理服务器,直接外来请求转发给后面的应用服务器(tomcat,Django等),tomcat更多用来做一个应用容器,让javawebapp泡在里面的东西。严格意义上来讲,Apache和nginx应该叫做HTTPServer,而tomcat是一个ApplicationServer是一个Servlet/JSO应用的容器。客户端通过HTTPServer访问服务器上存储的资源(HTML文件,图片文件等),HTTPServer是中只是把服务器

在使用 PHP 进行网站开发时,你可能会遇到字符编码问题。特别是在使用不同的 Web 服务器时,会发现 IIS 和 Apache 处理字符编码的方法不同。当你使用 IIS 时,可能会发现在使用 UTF-8 编码时出现了乱码现象;而在使用 Apache 时,一切正常,没有出现任何问题。这种情况应该怎么解决呢?

Pacemaker是适用于类Linux操作系统的高可用性集群软件。Pacemaker被称为“集群资源管理器”,它通过在集群节点之间进行资源故障转移来提供集群资源的最大可用性。Pacemaker使用Corosync进行集群组件之间的心跳和内部通信,Corosync还负责集群中的投票选举(Quorum)。先决条件在我们开始之前,请确保你拥有以下内容:两台RHEL9/8服务器RedHat订阅或本地配置的仓库通过SSH访问两台服务器root或sudo权限互联网连接实验室详情:服务器1:node1.exa

PHP5.6和Apache是Web开发中最常用的工具之一。然而,有时候,当我们尝试调用PHP5.6时,会遇到一些问题,例如无法调用PHP文件或页面等等。在本文中,我将探讨为什么您可能无法调用PHP5.6以及如何解决这个问题。


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Atom editor mac version download
The most popular open source editor

Dreamweaver Mac version
Visual web development tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.
