我有一个非常古老的Joomla-1.0网站,上面有数以万计的文章我们最近升级到了当前版本的Joomla和SEF。这是关于fedora29的apache-2.4.34。
问题是它不再支持旧的URL格式,所以我试图重写许多旧的URL格式以使用该站点。
我遇到的最难的一个包含查询字符串:
example.com/index.php?option=login
这应该重定向到example.com/register
但是,我的重写规则不起作用:
# /index.php?option=login
RewriteEngine on
RewriteCond %{QUERY_STRING} ^option=login$
RewriteRule ^/index.php$ https://linuxsecurity.com/register [R=301,L,QSD]
它放在文档根目录中的.htaccess文件中。我也尝试将它放在虚拟域配置中的一个部分。
看起来它完全被忽略了。它会报告“未找到组件”之类的错误,好像它是由joomla解释的。
我还有几个其他RewriteRule条目似乎不起作用。他们只报告404页。如果我将文章ID输入到替换链接中,它可以正常工作。
RewriteRule ^/content/view/([^/]+) /index.php?option=com_content&view=article&id=$1 [R=301,L]
我很感激你能提供的任何建议。
您的情况很好,但需要调整登录规则。请试试:
RewriteEngine on
RewriteCond %{QUERY_STRING} ^option=login$
RewriteRule ^(.*) https://linuxsecurity.com/register [R=301,L,QSD]
对于其他内容重定向,这是我之前用于Joomla 1.0到Joomla 3.x的内容:
RewriteRule ^content/view/(.*)$ /index.php?option=com_content&view=article&id=$1 [L,R=301]
https://www.yellowwebmonkey.com/developer-blog/item/redirect-joomla-1-0-sef-links-for-joomla-3-x