IIS 上的 Joomla 301 重定向

发布于 2024-08-04 12:57:48 字数 1914 浏览 6 评论 0原文

我在 IIS 上运行 Joomla。我有大约十几个类别(财经通讯出版商),我用它们来组织大约 40 篇文章(财经通讯)。我正在使用 joomla 内置 SEO,因此 URL 如下所示:

http://www.global-autotrading.com/autotraded-newsletters/13-angel-publishing/43-options-trading-pit.html

前面的数字类别和文章的数量很烦人,而且我不太喜欢“部分布局”菜单项提供的导航。此外,一些财经通讯不在出版商的保护下运作,所以我想要一个更灵活的组织。

我尝试简单地构建一个菜单层次结构(在自动交易新闻通讯菜单下),其中一些新闻通讯直接位于父菜单项下,而一些发布商将其新闻通讯作为其下方的菜单项。然而,这导致一些链接中断;单击链接会将我带到错误的文章,等等。因此,使用手动编码的菜单结构似乎与使用内容的另一个“并行”部分布局视图不兼容。

因此,我决定放弃使用类别来组织内容的想法。我将为每个“出版商”类别创建一篇文章。我将在该出版商的文章中手动添加指向每个出版商的新闻通讯的链接。我还将创建一个并行菜单结构,就像我上面描述的那样。

不管怎样,这是很多背景信息,希望我能得到一些确认,证明我没有做一些根本上有缺陷的事情。

问题是有外部网站直接链接到上面的某些 URL。我不希望这些链接被破坏(我相信这是典型的 SEO 问题)。我认为解决方案是使用 301 重定向(例如)从以下位置重定向:

http://www.global-autotrading.com/autotraded-newsletters/13-angel-publishing/43-options-trading-pit.html

往返

http://www.global-autotrading.com/autotraded-newsletters/angel-publishing/options-trading-pit.html

< a href="http://www.global-autotrading.com/autotraded-newsletters/4-10-percent-per-month/12-10-percent-per-month.html" rel="nofollow noreferrer">http ://www.global-autotrading.com/autotraded-newsletters/4-10-percent-per-month/12-10-percent-per-month.html

http://www.global-autotrading.com/autotraded-newsletters/10-percent-per-month.html

创建 301 重定向有各种指南在 IIS 中(例如:http://www.webconfs.com/how -to-redirect-a-webpage.php),但我想知道这些是否与 Joomla 兼容,特别是与打开 SEO 功能的 Joomla 兼容。

另外,如果我似乎做了一些根本错误的事情,请告诉我:)

谢谢!

I'm running Joomla on IIS. I've got about a dozen categories (financial newsletter publishers) that I'm using to organize about 40 articles (financial newsletters). I'm using the joomla built-in SEO so the URL's look like this:

http://www.global-autotrading.com/autotraded-newsletters/13-angel-publishing/43-options-trading-pit.html

The numbers in front of the categories and articles are annoying, and I'm not too fond of the navigation provided by a Section Layout menu item. Also, some financial newsletters don't operate under the umbrella of a publisher so I want a more flexible organization.

I've tried simply constructing a menu hierarchy (under the autotraded newsletters menu) that has some newsletters directly under the parent menu item, and some publishers with their newsletters as menu items underneath them. However, that was causing some links to break; clicking on a link would take me to the wrong article, and what not. Thus, it seems like using a hand-coded menu structure is not compatible with using another, "parallel" section-layout view of the content.

Thus, I've decided to get rid of the idea of using categories to organize that content. I'm going to create an article for each "publisher" category. I'll manually add links to each publisher's newsletters in that publisher's article. I'll also create a parallel menu structure like I was describing above.

Anyway, that's a lot of background info, with the hope that I'll get some confirmation that I'm not doing something fundamentally flawed.

The problem is that there are external sites linking directly to some URLs like above. I don't want these links to break (classic SEO problem, I believe). I think the solution is to use 301 redirects to (for example) redirect from:

http://www.global-autotrading.com/autotraded-newsletters/13-angel-publishing/43-options-trading-pit.html

to

http://www.global-autotrading.com/autotraded-newsletters/angel-publishing/options-trading-pit.html

or from

http://www.global-autotrading.com/autotraded-newsletters/4-10-percent-per-month/12-10-percent-per-month.html

to

http://www.global-autotrading.com/autotraded-newsletters/10-percent-per-month.html

There are various guidelines around for creating 301 redirects in IIS (ex: http://www.webconfs.com/how-to-redirect-a-webpage.php), but I was wondering if these are compatible with Joomla, particularly with Joomla with the SEO features turned on.

Also, if it seems like I'm doing something fundamentally wrong, please let me know :)

Thanks!

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

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

发布评论

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

评论(2

相守太难 2024-08-11 12:57:48

这是有效的 web.config 文件的重写部分。最棘手的部分是弄清楚重定向规则需要位于 web.config 中的 SEO 规则之前

<rewrite>
  <rewriteMaps>
    <rewriteMap name="StaticRedirects">
      <add key="/old-url-1.html" value="new-url-1.html" />
      <add key="/old-url-2.html" value="new-url-2.html" />
    </rewriteMap>
  </rewriteMaps>
  <rules>
    <rule name="Security Rule" stopProcessing="true">
      <match url="^(.*)$" ignoreCase="false" />
      <conditions logicalGrouping="MatchAny">
        <add input="{QUERY_STRING}" pattern="mosConfig_[a-zA-Z_]{1,21}(=|\%3D)" ignoreCase="false" />
        <add input="{QUERY_STRING}" pattern="base64_encode.*\(.*\)" ignoreCase="false" />
        <add input="{QUERY_STRING}" pattern="(\<|%3C).*script.*(\>|%3E)" />
        <add input="{QUERY_STRING}" pattern="GLOBALS(=|\[|\%[0-9A-Z]{0,2})" ignoreCase="false" />
        <add input="{QUERY_STRING}" pattern="_REQUEST(=|\[|\%[0-9A-Z]{0,2})" ignoreCase="false" />
      </conditions>
      <action type="CustomResponse" url="index.php" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" />
    </rule>
    <rule name="Redirect Rule" stopProcessing="false">
      <match url=".*" />
      <conditions>
        <add input="{StaticRedirects:{REQUEST_URI}}" pattern="(.+)" />
      </conditions>
      <action type="Redirect" url="{C:1}" appendQueryString="False" redirectType="Permanent" />
    </rule>
    <rule name="SEO Rule">
      <match url="(.*)" ignoreCase="false" />
      <conditions logicalGrouping="MatchAll">
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" pattern="" ignoreCase="false" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" pattern="" ignoreCase="false" />
        <add input="{URL}" negate="true" pattern="^/index.php" ignoreCase="false" />
        <add input="{URL}" pattern="(/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$" />
      </conditions>
      <action type="Rewrite" url="index.php" />
    </rule>
  </rules>
</rewrite>

Here is the rewrite section of a web.config file that works. The trickiest part was to figure out that the redirect rules need to preceed the SEO rules in the web.config

<rewrite>
  <rewriteMaps>
    <rewriteMap name="StaticRedirects">
      <add key="/old-url-1.html" value="new-url-1.html" />
      <add key="/old-url-2.html" value="new-url-2.html" />
    </rewriteMap>
  </rewriteMaps>
  <rules>
    <rule name="Security Rule" stopProcessing="true">
      <match url="^(.*)$" ignoreCase="false" />
      <conditions logicalGrouping="MatchAny">
        <add input="{QUERY_STRING}" pattern="mosConfig_[a-zA-Z_]{1,21}(=|\%3D)" ignoreCase="false" />
        <add input="{QUERY_STRING}" pattern="base64_encode.*\(.*\)" ignoreCase="false" />
        <add input="{QUERY_STRING}" pattern="(\<|%3C).*script.*(\>|%3E)" />
        <add input="{QUERY_STRING}" pattern="GLOBALS(=|\[|\%[0-9A-Z]{0,2})" ignoreCase="false" />
        <add input="{QUERY_STRING}" pattern="_REQUEST(=|\[|\%[0-9A-Z]{0,2})" ignoreCase="false" />
      </conditions>
      <action type="CustomResponse" url="index.php" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" />
    </rule>
    <rule name="Redirect Rule" stopProcessing="false">
      <match url=".*" />
      <conditions>
        <add input="{StaticRedirects:{REQUEST_URI}}" pattern="(.+)" />
      </conditions>
      <action type="Redirect" url="{C:1}" appendQueryString="False" redirectType="Permanent" />
    </rule>
    <rule name="SEO Rule">
      <match url="(.*)" ignoreCase="false" />
      <conditions logicalGrouping="MatchAll">
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" pattern="" ignoreCase="false" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" pattern="" ignoreCase="false" />
        <add input="{URL}" negate="true" pattern="^/index.php" ignoreCase="false" />
        <add input="{URL}" pattern="(/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$" />
      </conditions>
      <action type="Rewrite" url="index.php" />
    </rule>
  </rules>
</rewrite>
再见回来 2024-08-11 12:57:48

与此类似的代码最近包含在从版本 1.6.2 开始的默认 Joomla 安装中。

重要的是,所有外部重定向都应在任何内部重写之前列出,否则重写的指针将无意中作为新 URL 暴露在 Web 上。

Code similar to this was recently included in the default Joomla install starting at version 1.6.2.

It is important that all external redirects are listed before any internal rewrites, otherwise the rewritten pointer will be inadvertently exposed back on to the web as a new URL.

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