【问题标题】:x-cart 5.3.1.3 Clean URL and Static pages not workingx-cart 5.3.1.3 清理 URL 和静态页面不起作用
【发布时间】:2016-10-12 04:09:17
【问题描述】:

这几天我一直很困惑。使用 Clean URL 时,所有 .html 页面都会重定向到主页。这发生在静态和动态生成的页面上。但是,所有 .php 页面都可以正常工作。我正在使用以下 .htaccess 并在域上运行 SSL。

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php [L]

此信息来自原始安装,以及多个在线来源。无论如何,我都不是专家,真的可以使用一些帮助。其中大部分对我来说都是陌生的。

有什么建议吗? 谢谢!

【问题讨论】:

  • 此外,即使关闭了 Clean URL 开关,所有静态页面也会重定向到主页。

标签: apache url static x-cart


【解决方案1】:

试试这个。

<IfModule mod_rewrite.c>
  RewriteEngine on

  RewriteCond %{HTTP:Authorization} ^(.*)
  RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]

  RewriteRule (^|/)\. - [F]

  # Admin.php redirect rules.
  # Uncomment underlaying lines and replace <new_admin> with your path to admin.php.
  # Any requests to <new_admin>.php will be redirected to the real admin.php file.
  # RewriteCond %{ENV:REDIRECT_STATUS} ^$
  # RewriteRule ^admin\.php(.*)$ - [NS,NC,L,R=404]
  # RewriteRule ^<new_admin>\.php(.*)$ admin.php$1 [NC,L,QSA]

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^sitemap.xml(\?.+)?$ cart.php?target=sitemap [NC,L,QSA]

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^((([/_a-z0-9-]+)/)?([_a-z0-9-]+)/)?([_a-z0-9-]+)(/?)(\.([_a-z0-9-]+))?$ cart.php?url=$5&last=$4&rest=$3&ext=$7 [NC,L,QSA]

  RewriteBase /
</IfModule>

【讨论】:

    【解决方案2】:

    请查看原始 .htaccess: https://raw.githubusercontent.com/xcart/xcart5/master/src/.htaccess

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^((([/_a-z0-9-]+)/)?([_a-z0-9-]+)/)?([_a-z0-9-]+)(/?)(\.([_a-z0-9-]+))?$ cart.php?url=$5&last=$4&rest=$3&ext=$7 [NC,L,QSA]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-04-15
      • 1970-01-01
      相关资源
      最近更新 更多