Home Backend Development PHP Problem How to hide index.php in wamp

How to hide index.php in wamp

May 18, 2021 am 10:41 AM
index.php wamp

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>
Copy after login

推荐学习:《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 of this Website
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

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1662
14
PHP Tutorial
1261
29
C# Tutorial
1234
24
Teach you to create a virtual host and run php projects (phpstudy + wamp) Teach you to create a virtual host and run php projects (phpstudy + wamp) Aug 07, 2022 pm 03:17 PM

This article involves two PHP integrated environments, both of which contain mysql + apache + php. The function of phpstudy is more powerful than wamp, and it is very simple and easy to use.

How to modify the php.ini file in wamp How to modify the php.ini file in wamp Mar 20, 2023 pm 03:33 PM

Wampserver is a software package that can install Apache, PHP and MySQL on Windows computers. Develop and test PHP websites on your local computer easily with Wampserver. During the development process, we may need to modify the PHP configuration file php.ini. This article will introduce how to modify the php.ini file in Wampserver.

[Summary] Reasons and solutions why WAMP cannot parse PHP files [Summary] Reasons and solutions why WAMP cannot parse PHP files Mar 22, 2023 am 10:38 AM

​WAMP is a free and open source web server software package that allows users to build a web server environment on Windows operating systems. However, when users try to run PHP files in WAMP, they may encounter unresolved errors. In this article, we will explore the reasons and solutions for why WAMP cannot parse PHP files.

A brief analysis of the solution to the problem of garbled PHP files in WAMP environment A brief analysis of the solution to the problem of garbled PHP files in WAMP environment Mar 22, 2023 am 09:30 AM

In the process of using WAMP as a local server environment, the problem of garbled PHP files sometimes occurs. This kind of problem will not only affect our code writing, but also affect the normal operation of our website. In this article, we will introduce some methods to solve garbled PHP files in WAMP.

Install WAMP on CentOS and cannot click on the desktop after CentOS installation. Install WAMP on CentOS and cannot click on the desktop after CentOS installation. Feb 11, 2024 pm 04:51 PM

Introduction to the directory of this article: CentOS installs WAMP, installs Apache, installs MySQL, installs PHP, configures WAMP. After CentOS is installed, you cannot enter the desktop and cannot click to restart. Update the desktop environment or reinstall the driver. Reset the desktop configuration. Change the desktop environment. LINUX knowledge sharing. CentOS installs WAMP. CentOS is a Linux-based system. Operating system for server and desktop applications, WAMP is a development environment for running web applications on Windows operating system. In this article, we will introduce how to install WAMP on CentOS. To install Apache we need to install Apache as a web server and execute the following command in the terminal

How to remove index.php from the server How to remove index.php from the server Dec 19, 2022 am 10:24 AM

How to remove index.php from the server: 1. Open the php.ini file and change the content to "cgi.fix_pathinfo=1"; 2. Modify the configuration file of the corresponding virtual host; 3. Change "include enable-php.conf;" Replace with "include enable-php-pathinfo.conf;"; 4. Remove index.php and restart lnmp.

How to remove index.php from https URL How to remove index.php from https URL Mar 20, 2023 pm 03:35 PM

The string index.php often appears in the URLs of many websites. Although this file is very important, sometimes users want to remove this string from their URLs to make the website structure clearer.

Deploy and run projects on Windows using PHP and WAMP Deploy and run projects on Windows using PHP and WAMP Jun 25, 2023 pm 01:44 PM

With the continuous development of Internet technology, developing a website or application has become the norm in the software industry. As a developer, deployment and operation are inevitable steps in project development. This article will introduce how to use PHP and WAMP to deploy and run projects on Windows systems. 1. What is WAMP WAMP is a web service software package suitable for Windows operating system, where W represents Windows operating system, A represents Apache server, and M represents

See all articles