是否可以为同一个 WordPress 博客提供不同的链接?

发布于 2024-11-02 15:31:06 字数 420 浏览 3 评论 0原文

我使用 WordPress 开发了一个网站。我的网站有两个主要链接,例如 www.mysite.com/siteonewww.mysite.com/sitetwo,但我只管理了一个博客内容。现在我需要做的是我想将同一个博客链接到不同的链接,如下所示: www.mysite.com/siteone/blogwww.mysite.com/sitetwo/blog 并且还需要具有相同的链接内容 www.mysite.com /siteone/blog-1www.mysite.com/sitetwo/blog-1。是否可以这样做,如果可以,那么该怎么做?如果不是的话我能做什么呢?

提前致谢

I have developed a site using wordpress. I have two main links in the site e.g. www.mysite.com/siteone and www.mysite.com/sitetwo and I have managed only one blog contents. Now what I need to do is that I want to link the same blog with different link like this:
www.mysite.com/siteone/blog and www.mysite.com/sitetwo/blog and also need to have same content for links www.mysite.com/siteone/blog-1 and www.mysite.com/sitetwo/blog-1. Is it possible to do so, if yes then how to do that? If not then what can I do for that?

Thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

灯角 2024-11-09 15:31:06

从 SEO 的角度来看,使用规范标签是明智的。该标签是一个新的构造,明确设计用于识别和
处理重复的内容。实现非常简单,如下所示:

<link rel="canonical" href="http://www.yoursite.org/blog" />

该标签旨在告诉 Yahoo!、Bing 和 Google 应处理有问题的页面
就像它是 URL http://www.yoursite.org/blog 的副本一样的链接和
从技术上讲,引擎应用的内容指标应该流回该 URL。
规范 URL 标签属性在很多方面与 SEO 的 301 重定向相似
看法。本质上,您是在告诉引擎多个页面应该被视为
一个(301 所做的),而不实际将访问者重定向到新的 URL(通常会保存
你的开发人员麻烦了)。

<一href="http://www.google.com/url?sa=t&source=web&cd=1&ved=0CCAQFjAA&url=http://www.amazon.com/Art-SEO-Theory-Practice /dp/0596518862& ;rct=j&q=%20art%20of%20seo&ei=3dyvTfOvF4-LswaOp8DkCw&usg=AFQ jCNG40N8ozqOzl6ThSgEQD8DZuDjopw&sig2=QTHR-Zy_qVqnYqd8t9UWbg&cad=rja" rel="nofollow">链接

From the SEO perspective, it's wise to use canonical tag. This tag was a new construct designed explicitly for purposes of identifying and
dealing with duplicate content. Implementation is very simple and looks like this:

<link rel="canonical" href="http://www.yoursite.org/blog" />

This tag is meant to tell Yahoo!, Bing, and Google that the page in question should be treated
as though it were a copy of the URL http://www.yoursite.org/blog and that all of the link and
content metrics the engines apply should technically flow back to that URL.
The canonical URL tag attribute is similar in many ways to a 301 redirect from an SEO
perspective. In essence, you’re telling the engines that multiple pages should be considered as
one (which a 301 does), without actually redirecting visitors to the new URL (often saving
your development staff trouble).

link

甚是思念 2024-11-09 15:31:06

WordPress 安装中的“主页”链接由数据库中名为 siteurl 的选项确定,因此理论上您只需在两个博客上使用相同的数据库并覆盖 siteurl 在这两个网站上,使其看起来像是两个不同的网站。

一个好的开始方法是在 wp-config.php 中定义一个常量,两个网站的常量应该不同:

define( 'MY_SITE_URL', 'http://yoursite.com/siteone/blog' );

然后编写一个单行插件,只需向 get_option 添加一个过滤器调用 siteurl。像这样的事情:

add_filter( 'option_siteurl', create_function( '$value', 'return MY_SITE_URL;' ) );

这只是开始,如果这对您有用,您将不得不在您的 wp-content 目录中徘徊,以确保它们在两个网站上同步,即在将图像上传到一个博客后,您将需要将文件复制到另一个文件中。

我确实设法使用两个不同的数据库在一个 WordPress 安装下运行两个不同的网站,但是让两个 WordPress 安装在两个不同域下的一个站点上运行,这是很棘手的;)

~ K

The "home" link in a WordPress installation is determined by an option in the database called siteurl, so in theory you'll just have to use the same database on both blogs and override the siteurl on the two to make it seem like two different websites.

A good way to start from is define a constant in your wp-config.php, which should be different for both websites:

define( 'MY_SITE_URL', 'http://yoursite.com/siteone/blog' );

And then write a single-line plugin that would simply add a filter to the get_option call for siteurl. Something like this:

add_filter( 'option_siteurl', create_function( '$value', 'return MY_SITE_URL;' ) );

That's only the start, and if that works for you you'll have to then rumble around your wp-content directory to make sure they are in sync for both websites, i.e. after uploading an image to one blog you'll need to copy the file into the other one.

I did manage to get two different websites working under one WordPress installation using two different databases, but having two WordPress installations working line one site under two different domains, that's tricky ;)

~ K

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文