简体   繁体   English

.htaccess在子文件夹中使用Wordpress重定向

[英].htaccess Redirect with Wordpress in a subfolder

I am moving an old site to a new site. 我正在将旧站点移到新站点。 But the new site is built into Wordpress in a sub-folder. 但是新站点内置在子文件夹中的Wordpress中。

IE: http://domainA.com TO: http://domainB.com/wordpress/ IE: http://domainA.com : http://domainA.com TO: http://domainB.com/wordpress/ : http://domainB.com/wordpress/

The Problem that i'm having is the NEWS part of the site. 我遇到的问题是网站的新闻部分。 So basically I have a URL that is, 所以基本上我有一个URL,

http://domainA.com/article/post-title-url-slug/

Which needs to now go to 现在需要去哪

http://domainB.com/*wordpress*/post-title-url-slug/

Where wordpress is the ROOT installation. 其中wordpress是ROOT安装。

Hope this makes sense, any help would be greatly appreciated, I haven't been able to find a solution on SO yet.... 希望这是有道理的,任何帮助将不胜感激,我还无法在SO上找到解决方案。...

EDIT - FOLDER STRUCTURE 编辑 -文件夹结构

/Root (APP) /根(APP)

/Root/careers/ (careers === wordpress install, wp-content...etc) / Root / careers / (职业=== wordpress安装,wp-content ...等)

The HTACCESS For /careers/ IS HTACCESS对于/职业/ IS

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

I have removed the BASE category in the URL, so my URLS would be like. 我已经删除了URL中的BASE类别,所以我的URL就像这样。

http://www.example.com/ careers /[ category -title] http://www.example.com/ 职业 / [ 类别-标题]

But what I need to setup now is, when they click on a SINGLE POST, it goes to a URL like this. 但是我现在需要设置的是,当他们单击“单个帖子”时,它会转到这样的URL。

http://www.example.com/ article /[ post -title] http://www.example.com/ 文章 / [ 帖子标题]

That's a just simple 301 rewrite. 这只是简单的301重写。 This code goes in the .htaccess in the root of domainA.com . 此代码位于domainA.com根目录中的.htaccess中。

RewriteEngine On
RewriteRule ^article/(.*)$ http://domainB.com/wordpress/$1 [R=301,L]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM