Wordpress rewrite.htaccess

Wordpress rewrite.htaccess,wordpress,apache,Wordpress,Apache,我正在尝试添加一个.htaccess文件,以便Wordpress可以使用自定义永久链接 我已将以下脚本添加到位于/web的根目录中: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d 重新启动发动机 重写基/ 重写规

我正在尝试添加一个
.htaccess
文件,以便Wordpress可以使用自定义永久链接

我已将以下脚本添加到位于
/web
根目录中:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

重新启动发动机
重写基/
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
虽然我已经将
.htaccess
文件与此一起添加到
根目录
,但它似乎仍然不起作用


我遗漏了什么吗

这是给你的清单

  • 确保启用了
    mod_rewrite
  • 如果使用Fedora、SuSE或CentOS,请确保配置了
    selinux
  • 确保在
    httpd.conf

  • 我们在网站上使用的版本如下所示:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress
    
    #开始WordPress
    重新启动发动机
    重写基/
    重写规则^index\.php$-[L]
    重写cond%{REQUEST_FILENAME}-F
    重写cond%{REQUEST_FILENAME}-D
    重写规则/index.php[L]
    #结束WordPress
    

    开始和结束的WordPress在我看来就像是评论,但也许他们是沿途需要的人。另外,在我们的站点上,.htaccess是permissions 644(chmod 644.htaccess),由apache所有。希望能有所帮助。

    看起来您缺少上一条重写规则和结束标记。 重写规则/index.php[L]和结束标记

    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /
        RewriteRule ^index\.php$ - [L]
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule . /index.php [L]
        </IfModule>
    
    
    重新启动发动机
    重写基/
    重写规则^index\.php$-[L]
    重写cond%{REQUEST_FILENAME}-F
    重写cond%{REQUEST_FILENAME}-D
    重写规则/index.php[L]
    

    一旦您将其添加到中,转到管理区域中的永久链接页面。加载此页面将刷新永久链接。在那之后,您应该都设置好了。

    您的服务器上是否启用了mod_rewrite.c?我如何检查它?在
    httpd.conf
    中查找
    mod_rewrite
    。如果它存在,请确保它没有被注释掉(开始时有一个
    )。使用
    phpinfo()
    创建一个php文件,请参见: