Configuring .htaccess single point of entry_PHP tutorial
Jul 13, 2016 pm 05:51 PM
First enable the mod_rewrite module (adjust according to different operating systems, currently Linux)
1. Apache enables 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 .htaccess in the project root directory and redirect the request to the public directory (adjust as needed)
1 <IfModule mod_rewrite.c>
2 RewriteEngine on
3 RewriteRule ^$ public/ [L]
4 RewriteRule (.*) public/$1 [L]
5 </IfModule>
Finally, forward the request to the public/index.php file, (distribute all requests here)
1 <IfModule mod_rewrite.c>
2 RewriteEngineOn
3
4 RewriteCond %{REQUEST_FILENAME} !-f
5 RewriteCond %{REQUEST_FILENAME} !-d
6
7 RewriteRule ^(.*)$ index.php?url=$1 [PT,L]
8
9 </IfModule>
app->public->index.php
This can achieve a single entrance to a website and is also the starting point of the MVC model. The next step can be to try to distribute our url as three parts controller/action/querystring.....
Excerpted from warcraft

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

deepseek web version entrance deepseek official website entrance

Pi Node Teaching: What is a Pi Node? How to install and set up Pi Node?

gate Yishou app download official website gate.io app official download

Why can't the Bybit exchange link be directly downloaded and installed?

Coinsuper exchange software channel official website entrance

deepseek local deployment r1 model tutorial

BITGet official website installation (2025 beginner's guide)
