.htaccess文件将目录添加到URL

时间:2014-10-30 03:38:11

标签: .htaccess friendly-url modx

我有一个htaccess文件,可以将用户引导到非www网址。问题是,该网站的目录在点击时会添加到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>

非常感谢任何帮助。

谢谢!

1 个答案:

答案 0 :(得分:0)

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