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.

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!

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

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 English version
Recommended: Win version, supports code prompts!

SublimeText3 Chinese version
Chinese version, very easy to use

Dreamweaver Mac version
Visual web development tools

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft





