joomla - SEO设置和mod_rewrite

时间:2010-03-23 14:38:21

标签: mod-rewrite seo joomla

我正在使用Joomla 1.5.14,我配置了SEO,如下图所示

alt text http://i40.tinypic.com/r85pcp.png

现在我需要将一些旧网址映射到新网站

假设我需要将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网址(假设上面的页面可以通过htp://mysite/contacts.html访问),我会收到404错误

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

现在的问题是:

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

提前谢谢

斯特凡诺

1 个答案:

答案 0 :(得分:3)

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

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

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

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

(您可能需要old.html前面的正斜杠