0 minutes, 5 seconds

发布时间:2023-10-30 16:45:32

在网站根目录创建文件.htaccess

文件内容如下:


Apache伪静态:

<IfModule mod_rewrite.c>
RewriteEngine on
# Apache 2.4
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^(.*?)([^/]*)$ $1index.php?$2 [QSA,PT,L]
# Apache other
#RewriteRule ^(.*?)([^/]*)\.htm(.*)$ $1/index.php?$2.htm$3 [L]
</IfModule>


Nginx伪静态:

location ~* \.(htm)$ {
    rewrite "^(.*)/(.+?).htm(.*?)$" $1/index.php?$2.htm$3 last;
}


Caddy伪静态(Caddyfile演示):

www.yourdomain.com {
# Set this path to your site's directory.
root * /var/www
file_server
# Or serve a PHP site through php-fpm:
php_fastcgi localhost:9000
}