首页 > 解决方案 > 使用 .htaccess 将 Wordpress 子文件夹重定向到 index.php

问题描述

所以我在 Wordpress 和主 Wordpress 目录中有网站,我创建了目录 /w。所以我在主目录目录中

在 /w 中,我有目录 /app 和 /public。使用 .htaccess 拒绝访问应用程序。现在,在 /public 中,我有文件 index.php 和 .htaccess。我想要做的是将所有网址从mydomain.com/w/something/something2重定向到mydomain.com/w/public/index.php

下面是我在 /w/public 中的 .htacces

Options -MultiViews

RewriteEngine on
RewriteBase /w/public
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?url=$1 [NC,L,QSA]

现在,当我输入 url mydomain.com/w/something 时,我得到了 Wordpress 404 页面。希望some1可以帮助我:)

标签: phpwordpress.htaccessredirect

解决方案


推荐阅读