萝卜头IT论坛

搜索
查看: 565|回复: 1
收起左侧

[SEO技巧] LAMP Typecho伪静态教程

[复制链接]
发表于 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>
  2. Options Indexes FollowSymLinks
  3. AllowOverride None
  4. Require all granted
  5. </Directory>
复制代码
如没有相应配置 则手动添加

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

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

补充内容 (2024-4-1 22:52):
开启地址重写前记得再次重启apache          sudo systemctl restart apache2
回复

使用道具 举报

 楼主| 发表于 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>
回复

使用道具 举报

联系我们(Contact)|手机版|萝卜头IT论坛 ( 苏ICP备15050961号-1 )

GMT+8, 2024-5-3 05:42 , Processed in 0.095777 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表