joomla - SEO 设置和 mod_rewrite
我使用的是 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
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为问题是因为 Apache 将
old.html
重写为实际不存在的页面,但以不同的规则重写。如果您确实想要“重写” - 换句话说,让页面在浏览器中保持为
old.html
- 那么您不需要执行任何操作。然而,为了避免重复内容,最好进行 301 重定向:(
您可能需要在
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:
(You may need a forward slash at the front of
old.html
)