First, enable the mod_rewrite module (adjusted according to the operating system, current linux) 1. enable the Mod_rewrite module in Apache:/etc/apache2/httpd. conf uncomment: LoadModulerewrite_module/usr/lib/apache2/modules/mod_rewrite.so2 ,.
First, enable the mod_rewrite module (adjusted according to the operating system, the current linux)
1. Apache enables the Mod_rewrite module
Edit:/etc/apache2/httpd. conf
Uncomment: LoadModule rewrite_module/usr/lib/apache2/modules/mod_rewrite.so
2. select Directory and change AllowOverride None to AllowOverride All.
3. restart Apache
Create a file in the project root directory. htaccess redirects the request to the public directory (adjusted as needed)
1
2 RewriteEngine on
3 RewriteRule ^ $ public/[L]
4 RewriteRule (. *) public/$1 [L]
5
Finally, redirect the request to the public/index. php file (distribute all requests here)
1
2 RewriteEngine On
3
4 RewriteCond % {REQUEST_FILENAME }! -F
5 RewriteCond % {REQUEST_FILENAME }! -D
6
7 RewriteRule ^ (. *) $ index. php? Url = $1 [PT, L]
8
9
App-> public-> index. php
In this way, we can implement a single portal for a website, which is also the starting point of the MVC mode. next we can try to distribute our url to three parts: controller/action/querystring .....
From warcraft