【问题标题】:Changing The Page URL in OpenCart using htaccess使用 htaccess 更改 OpenCart 中的页面 URL
【发布时间】:2014-12-29 09:41:04
【问题描述】:

我在 opencart 项目中遇到问题。我想使用 htaccess 将 url 更改为其他。

我们的链接是:-

http://domain.com/POSextension/index.php?route=pos/login

但我想像这样显示它:

http://domain.com/POSextension/pos

如何改变它?请帮帮我.. :(

【问题讨论】:

  • 两个域http://pos.domain.comhttp://domain.com 是否指向同一个DocumentRoot 目录?
  • 是的,这些指向同一个目录
  • 如何解决? @anubhava

标签: .htaccess opencart


【解决方案1】:

您可以在 DOCUMENT_ROOT/.htaccess 文件中使用此代码:

RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} ^(?:www\.)?pos\.domain\.com$ [NC]
RewriteRule ^(POSextension)/?$ $1/index.php?route=pos/login [L,QSA,NC]

但是,如果/POSextension/.htaccess 也存在,则使用此规则:

RewriteEngine On
RewriteBase /POSextension/

RewriteCond %{HTTP_HOST} ^(?:www\.)?pos\.domain\.com$ [NC]
RewriteRule ^/?$ index.php?route=pos/login [L,QSA,NC]

【讨论】:

  • 那种评论是没有用的,因为它没有任何其他相关细节。除了这个规则肯定是独立工作的,但我猜不出你可能有什么其他规则和 htaccess。
猜你喜欢
  • 2012-11-26
  • 1970-01-01
  • 1970-01-01
  • 2023-04-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-03-05
  • 2012-11-10
相关资源
最近更新 更多