分类: 操持

  • wordpress固定链接中出现index.php时需在ubuntu 开启伪静态

    原文链接:https://blog.csdn.net/haige025/article/details/89488171

    参考文章如下:

    http://www.cnblogs.com/flymood/p/4868401.html

    在ubuntu 下的设置方法为:

    用命令开启伪静态sudo a2enmod rewrite

    service apache2 restart

    然后在/etc/apache2/apache2.config中设置访问的站点

    <Directory /home/iat/workspace/PHPsite>

    Options Indexes FollowSymLinks

    AllowOverride ALL

    Require all granted

    </Directory>

    service apache2 restart

    2. 配置htaccess 文件

    Apache是 Linux 主机下常见的环境,现在一般的 Linux 虚拟主机都采用这种环境。新建一个 htaccess.txt 文件,添加下面的代码:

    1. <IfModule mod_rewrite.c>
    2. RewriteEngine On
    3. RewriteBase /
    4. RewriteRule ^index\.php$ – [L]
    5. RewriteCond %{REQUEST_FILENAME} !-f
    6. RewriteCond %{REQUEST_FILENAME} !-d
    7. RewriteRule . /index.php [L]
    8. </IfModule>

    然后上传到 WordPress 站点的根目录,重命名为 .htaccess 即可

    (flymood: 我好像是直接自动生成的,没有要手动添加)

    3、重启Apache
    /etc/init.d/httpd restart
        
    4、设置WordPress
    系统运维  www.osyunwei.com  温馨提醒:qihang01原创内容©版权所有,转载请注明出处及原文链接

    在WordPress后台-设置-固定链接-自定义结构,输入下面的代码,最后保存更改即可。        
    /archives/%post_id%.html