我的提供商建议我如何从 Joomla 1.5 安装 Joomla 3.5。他没有告诉我的是它会覆盖我现有的 1.5 文件结构。所以我不得不重建我的整个网站。我们没有一个旧别名与新别名匹配,并且一些别名将不再存在并会产生错误。我想将这些错误重定向到密切相关的新页面或自定义 404 错误页面。使用 .htaccess RewriteRules 是我想要使用的,但对语法有点困惑。
我想去 www.apolloenergiesinc.com/ct-menu-item-3 并更改它 www.apolloenergiesinc.com/about-us
我尝试了以下方法,但均无效。
RewriteRule ^ct-menu-item-3?$ about-us [NC]R[301][L]
RewriteRule ^/ct-menu-item-3?$ /about-us [NC]R[301][L]
RewriteRule ^\/ct\-menu\-item\-3\/?$ \/about\-us [NC]R[301][L]
我做错了什么?
最佳答案
您的 flags 中存在语法错误,应该是[NC,R=301,L]
RewriteRule ^ct-menu-item-3$ about-us [NC,R=301,L]
关于php - .htaccess 中的 RewriteRule 有问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38045227/