


How to configure to prohibit access to files other than index.php file
配置禁止访问index.php文件以外的文件的方法:1、新建【.htaccess】文件,增加重写规则;2、编辑httpd.conf文件,支持重写模块;3、重启apache服务。
在apache中web目录下,新建index.php,other.php 可以发现都可以访问。
(推荐教程:apache教程)
在web目录下新建文件(.htaccess),加入以下内容:
RewriteEngine on RewriteRule ^(.*)$ index.php/$1 [L]
修改http.conf,支持rewrite_module:
LoadModule rewrite_module modules/mod_rewrite.so
修改http.conf,修改AllowOverride None 为 AllowOverride All,配置文件中有多个AllowOverride,请注意AllowOverride的上下文。
重启apache:
/usr/local/httpd/bin/apachectl restart
相关推荐:php培训
The above is the detailed content of How to configure to prohibit access to files other than index.php file. For more information, please follow other related articles on the PHP Chinese website!

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

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Article discusses configuring Apache with Node.js using mod_proxy, common issues, load balancing, and security measures. Main focus is on setup and optimization.(159 characters)

This article details using Apache as a reverse proxy for blue-green deployments. It discusses configuring two identical Apache environments, implementing traffic switching via configuration changes or an external load balancer, and best practices fo

Article discusses configuring Apache as a reverse proxy, common issues, multi-server setup, and security measures. Main focus is on setup steps and enhancing security.

Apache HTTP Server, launched in 1995, is a widely-used, open-source web server known for its reliability, flexibility, and cost-effectiveness. It enhances website performance and security through caching, load balancing, and SSL/TLS support.

Article discusses configuring Apache for video streaming using mod_flvx and mod_h264_streaming, detailing installation, configuration, optimization, and common issues resolution.

The article discusses configuring Apache for server-side includes (SSI) using mod_include, detailing steps to enable and configure SSI, and addressing benefits and troubleshooting common issues.Character count: 159

Article discusses configuring Apache for multiple websites using virtual hosts, best practices, troubleshooting, and optimization steps. Main issue: efficient management of multiple domains on one server.

The article discusses top tools for monitoring Apache servers, focusing on their features, real-time capabilities, and cost-effectiveness. It also explains how to use these tools to optimize Apache performance.
