屏蔽转发的URL以在目录中使用Wordpress [英] Mask a forwarded url to wordpress in a directory

查看:63
本文介绍了屏蔽转发的URL以在目录中使用Wordpress的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在clientsite.com上为客户建立了一个网站.她开了一家新公司,想要一个wordpress网站.因此,我在clientite.com/wordpress中安装了wordpress.我无法在根目录中安装wordpress,因为那是她原始站点所在的位置,并且我需要在其自己的文件夹中安装wordpress网站.她在Godaddy拥有一个域名为newbusiness.com.我将其分配给bluehost(她的主机提供商)并将其添加为插件,现在当您访问newbusiness.com时,您会在地址栏中看到位于clientite.com/wordpress和newbusiness.com上的页面.正是我想要的.除此以外,当您导航到网站上的任何其他页面时,地址栏都将变回clientite.com/wordpress.不好.

I built a website for a client at clientsite.com. She has a new business and wants a wordpress site. So I installed wordpress in clientsite.com/wordpress. I can't install wordpress in the root because that's where her original site is and I need the wordpress site in its own folder. She has a domain with godaddy called newbusiness.com. I assigned that to bluehost (her host provider) and added it as an addon and now when you go to newbusiness.com you see the pages located at clientsite.com/wordpress, and newbusiness.com in the address bar. Exactly what I want. EXCEPT, when you navigate to any other page on the site, the address bar changes back to clientsite.com/wordpress. Not good.

我度过了一个痛苦的时刻,试图弄清楚如何在整个网站的地址栏中保留newbusiness.com.请帮忙!

I'm having a HORRIBLE time trying to figure out how to keep newbusiness.com in the address bar throughout the whole site. Please help!

推荐答案

一个非常简单的解决方案是在/wordpress文件夹中的.htaccess文件中添加几行.该文件是在安装过程中创建的,因此应该在该文件中.它可能包含以下内容:

One really simple solution is to add a few lines to the .htaccess file in your /wordpress folder. This file is created during the installation, so it should be there. It probably contains the following:

# 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

尝试添加以下3行:

RewriteCond %{HTTP_HOST} !newbusiness.com$ [NC]
RewriteCond %{REQUEST_URI} clientsite\.com/wordpress [NC]
RewriteRule ^(.*)clientsite\.com/wordpress(.*)$ $1newbusiness.com$2 [L,R=301]

在</IfModule>

right before </IfModule>

这篇关于屏蔽转发的URL以在目录中使用Wordpress的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆