LAMP Typecho伪静态教程

0Percent 发表于 2024-4-1 22:51:37
启用Mod_Rewrite
  1. sudo a2enmod rewrite
重启Apache
  1. sudo systemctl restart apache2
编辑/etc/apache2(apache目录下) 对应的conf文件
  1. sudo nano /etc/apache2/apache.conf
查找
  1. <Directory /var/www/html>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
    </Directory>
如没有相应配置 则手动添加

在网站目录(/var/www/html)下新建.htaccess
  1. sudo touch .htaccess

在Typecho后台开启重写地址选项即可

补充内容 (2024-4-1 22:52):
开启地址重写前记得再次重启apache sudo systemctl restart apache2
0Percent 发表于 2024-4-2 14:04:26
文章没有显示全 .htaccess内容为
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>
来源: 萝卜头IT论坛 查看完整版本