【问题标题】:.htaccess file adding directories to URL.htaccess 文件将目录添加到 URL
【发布时间】:2014-12-26 00:02:18
【问题描述】:

我有一个 htaccess 文件,它应该将用户定向到非 www URL。问题是,该站点的目录在单击时会添加到 URL 的末尾。

比如subdomain.domain.com变成了subdomain.domain.com/folder/home.html,没问题,但是如果再次点击链接,就变成了subdomain.domain.com/folder/folder/home。 html等。不太好。

这是 .htaccess 文件:

RewriteEngine On
RewriteBase /

# Rewrite www.domain.com -> domain.com -- used with SEO Strict URLs plugin
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^subdomain\.domain\.com [NC]
RewriteRule (.*) http://subdomain.domain.com/$1 [R=301,L]
#
# or for the opposite domain.com -> www.domain.com use the following
# DO NOT USE BOTH
#
#RewriteCond %{HTTP_HOST} .
#RewriteCond %{HTTP_HOST} !^www\.sitehere\.com [NC]
#RewriteRule (.*) http://www.sitehere.com/$1 [R=301,L]

# The Friendly URLs part
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]



# Make sure .htc files are served with the proper MIME type, which is critical
# for XP SP2. Un-comment if your host allows htaccess MIME type overrides.

#AddType text/x-component .htc


<FilesMatch "\.(ttf|otf|eot|woff)$">
  <IfModule mod_headers.c>
    Header set Access-Control-Allow-Origin "*"
  </IfModule>
</FilesMatch>

任何帮助将不胜感激。

谢谢!

【问题讨论】:

标签: .htaccess friendly-url modx


【解决方案1】:

检查模板中的基本 href 标记及其输出的系统变量,我认为它是 ++site_url [您可以在模板中检查它实际上是什么]

【讨论】:

    猜你喜欢
    • 2013-07-06
    • 1970-01-01
    • 1970-01-01
    • 2011-11-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多