search
HomeBackend DevelopmentPHP ProblemHow to hide index.php in wamp

How to hide index.php in wamp

May 18, 2021 am 10:41 AM
index.phpwamp

wamp隐藏index.php的方法:首先找到并打开“httpd-vhost.conf”文件;然后在“httpd-vhost.conf”文件下添加重写规则如“RewriteRule ^(.*)$/index.php/$1[L]...”即可。

How to hide index.php in wamp

本文操作环境:windows7系统、PHP7.1版,DELL G3电脑

wamp server虚拟主机设置index.php隐藏(入口文件隐藏)

注意使用wamp开发环境时,如果使用虚拟主机访问项目时需要将定义的重写规则必须在httpd-vhost.conf文件下添加重写规则,而不是自定义.htaccess文件,如下所示:

<VirtualHost *:80>
    //开启重写
        RewriteEngine on
        //哪些文件路径不定义重写,我的css和js等文件是放在public路径下,所以在视图文件中以/public开头的url不重写路径(注意&#39;/&#39;需要使用&#39;\’来进行转义)
        RewriteCond $1 !^(index\.php|\/public)
        //重写规则:可以不需要输入index.php来进行访问
        RewriteRule ^(.*)$ /index.php/$1 [L]
    //虚拟主机路径
        DocumentRoot "C:/****/project/lsm/"
        //虚拟主机访问地址自定义
        ServerName lings.dev
        <Directory "C:/****/project/lsm/">
            Options Indexes FollowSymLinks
            AllowOverride None
            Order allow,deny
            Allow from all
        </Directory>
</VirtualHost>

推荐学习:《PHP视频教程

The above is the detailed content of How to hide index.php in wamp. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools