mod-rewrite - joomla - SEO 设置和 mod_rewrite

标签 mod-rewrite seo joomla

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

alt text

现在我需要将一些旧 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?我哪里错了?

提前谢谢你

斯特凡诺

最佳答案

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

如果您真的想“重写”——换句话说,让页面在浏览器中保持为 old.html——那么您不需要做任何事情。

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

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

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

关于mod-rewrite - joomla - SEO 设置和 mod_rewrite,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2500735/

相关文章:

.htaccess - 启用 .htaccess 时 ubuntu 返回 500 错误

Wordpress 和 angular2 url 路由不起作用

php - 如何提高 Laravel 站点的安全性

php - 如何在joomla中的组件位置显示内容?

php - Jquery/PhP/Joomla 选择两个组合框之一不会更新

apache - 在 localhost 中的 xampp 中启用重写模式

apache - 删除所有子文件夹条件重写.htaccess Apache 1.3.42

seo - Sitemap/robots.txt 配置冲突

seo - SEO 的短 URL 或长 URL

css - 无法使用 Joomla 龙门更改 nav.menu 中悬停的链接颜色