首页 > 解决方案 > Wordpress 多站点 Htaccess 覆盖

问题描述

我正在尝试重写一个基本的文件夹,以覆盖 Wordpresses 默认的 htaccess。

我需要一个位于 domain.com/community/sso/index.php 的文件夹来强制解析为 domain.com/community/sso

这是我最近尝试的:

Options -MultiViews
RewriteEngine On

RewriteRule ^community  - [L]


RewriteBase /
RewriteCond %{REQUEST_FILENAME} .*\.(jpeg|jpg|gif|png)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . /public/404.php [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /sso/index.php [L]
</IfModule>```

标签: wordpressapache.htaccessmod-rewriteurl-rewriting

解决方案


您能否尝试在此处更改您当前规则的顺序(基于您的节目规则),无法测试它。请确保在测试您的 URL 之前清除浏览器缓存。

Options -MultiViews
RewriteEngine On
RewriteRule ^community  - [NC,L]

RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ /sso/index.php [L]

RewriteCond %{REQUEST_FILENAME} .*\.(jpeg|jpg|gif|png)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ /public/404.php [L]

推荐阅读