joomla - SEO 设置和 mod_rewrite

发布于 2024-08-25 20:14:22 字数 843 浏览 5 评论 0原文

我使用的是 Joomla 1.5.14,并按照下图配置了 SEO

替代文字

现在我需要将一些旧的 URL 映射到新站点,

假设我需要将 htp://mysite/old.html 映射到新的 Joomla 页面

http://mysite/index.php?option=com_content&view=article&id=32&Itemid=70

我在 .htaccess 文件中添加了以下内容

RewriteRule ^old\.html$ index.php?option=com_content&view=article&id=32&Itemid=70  #works!!

,效果很好,但是如果我使用.htaccess 中的 SEF URL(假设可以通过 htp://mysite/contacts.html 访问上述页面),我收到 404 错误

RewriteRule ^old\.html$ contacts.html   #this does not work

现在的问题:

是否可以在 RewriteRule 中使用 SEF URL ?我哪里错了?

提前谢谢你

斯特凡诺

I'm using Joomla 1.5.14 and I configured SEO as in the following image

alt text

Now I need to map a few old URL to the new site

let's say that I need to map htp://mysite/old.html to the new Joomla page

http://mysite/index.php?option=com_content&view=article&id=32&Itemid=70

I added in my .htaccess file the following

RewriteRule ^old\.html$ index.php?option=com_content&view=article&id=32&Itemid=70  #works!!

this works fine, but if I use the SEF URL in .htaccess (let's say the above page can be reached with htp://mysite/contacts.html), I obtain a 404 error

RewriteRule ^old\.html$ contacts.html   #this does not work

Now the question:

Is it possible use SEF URLs in RewriteRule? where am I wrong?

thank you in advance

stefano

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

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

发布评论

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

评论(1

萌酱 2024-09-01 20:14:22

我认为问题是因为 Apache 将 old.html 重写为实际不存在的页面,但以不同的规则重写。

如果您确实想要“重写” - 换句话说,让页面在浏览器中保持为 old.html - 那么您不需要执行任何操作。

然而,为了避免重复内容,最好进行 301 重定向:(

Redirect 301 old.html http://yoursite.com/contact.html

您可能需要在 old.html 前面添加一个正斜杠)

I think the problem is because Apache rewrites old.html to a page that doesn't actually exist, but rewritten in a different rule.

If you truly want to "rewrite" - in other words, have the page stay as old.html in the browser - then you don't need to do anything.

However to avoid duplicate content it's probably better to do a 301 redirect:

Redirect 301 old.html http://yoursite.com/contact.html

(You may need a forward slash at the front of old.html)

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