【问题标题】:OpenCart SEO index.php .htaccess redirectOpenCart SEO index.php .htaccess 重定向
【发布时间】:2023-04-10 11:26:01
【问题描述】:

我正在尝试将 /index.php?route=common/home 转发到域名本身。我已经尝试了下面的代码,但它破坏了登录页面。我认为问题在于他们为 /admin/index.php?route=common/home 使用了相同的 url,它不允许我登录到管理中心。我一直无法弄清楚如何修复以下重定向以限制来自管理文件夹。

非常感谢您对此事的任何帮助。

# Redirect index to domain
RewriteCond %{QUERY_STRING} ^route=common/home$
RewriteCond %{REQUEST_METHOD} !^POST$
RewriteRule ^index\.php$ http://www.mysite.com? [R=301,L]

【问题讨论】:

  • 我在寻找 .htaccess 修复而不是 php 修复。如果有影响已编辑文件的更新,您将不得不再次编辑它。因此 .htaccess 重定向的原因。
  • 我明白,但以上将完全删除 common/home。此外,您可以编写一个非常简单的 vQmod 来为您执行此操作,这样新版本就不会覆盖代码

标签: regex .htaccess mod-rewrite opencart


【解决方案1】:

尝试用这个替换你的规则:

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+index\.php\?route=common/home[?\s] [NC]
RewriteRule ^ /? [R=301,L]

【讨论】:

  • 谢谢 这正是我想要的,而且效果很好。
猜你喜欢
  • 1970-01-01
  • 2010-12-07
  • 1970-01-01
  • 2013-11-28
  • 1970-01-01
  • 2013-01-21
  • 2014-08-31
  • 1970-01-01
  • 2018-05-27
相关资源
最近更新 更多