2014-10-30 130 views
1

我有一个htaccess文件,应该将用户指向非www网址。问题是,该网站有点击时添加到URL末尾的目录。.htaccess文件添加目录到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> 

任何帮助将不胜感激。

谢谢!

+0

也许你会在这里找到答案:HTTP ://stackoverflow.com/questions/234723/generic-htaccess-redirect-www-to-non-www – bmiljevic 2014-10-30 09:27:44

回答

0

检查你的基地,在你的模板href标记,它输出的系统变量,我认为这是++ SITE_URL [你可以在你的模板检查它实际上是什么]