2," to the project's configuration file; 3. Open Apache's httpd.conf file; 4. Delete the # symbol in front of mod_rewrite.so; 5. Restart Apache."/> 2," to the project's configuration file; 3. Open Apache's httpd.conf file; 4. Delete the # symbol in front of mod_rewrite.so; 5. Restart Apache.">
search
HomePHP FrameworkThinkPHPHow to remove url index in thinkphp

How to remove url index in thinkphp

Dec 05, 2022 am 10:44 AM
thinkphp

Thinkphp method to remove url index: 1. Move the .htaccess file to the root directory of the project; 2. Add "'URL_MODEL'=> 2," to the project configuration file; 3. Open Apache's httpd.conf file; 4. Delete the # symbol in front of mod_rewrite.so; 5. Restart Apache.

How to remove url index in thinkphp

The operating environment of this tutorial: Windows 7 system, ThinkPHP version 5, Dell G3 computer.

How to remove url index in thinkphp?

Removing index.php from ThinkPHP URL

Removing index.php from ThinkPHP URL is divided into two steps:

One: First What you want to achieve is to remove index.php in the browser navigation bar and still access the website normally

1, move the .htaccess file to the root directory of your project

2, Add

'URL_MODEL'             =>  2,       
// URL访问模式,可选参数0、1、2、3,代表以下四种模式:
  // 0 (普通模式); 1 (PATHINFO 模式); 2 (REWRITE  模式); 3 (兼容模式)  默认为PATHINFO 模式(经测验,此处 'URL_MODEL' => 1或2 都可以 没太大的影响)

3 to the project configuration file, and perform relevant configuration in Apache

In Apache's httpd.conf file, remove the # in front of LoadModule rewrite_module modules/mod_rewrite.so and restart Apache

2: After completing the above operation, you can access the website normally without adding index.php. However, most links in websites using ThinkPHP are implemented using U(). You will find that The link to jump to when you click on the font or picture with the tag exists in index.php, so the second step below is to remove the index.php

brought by using U() in the entry file. Just add define('__APP__',' ') to index.php in the root directory of the project.

Okay, give it a try!

Recommended learning: "thinkPHP Video Tutorial"

The above is the detailed content of How to remove url index in thinkphp. 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

DVWA

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

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools