2014-03-13 117 views
1

我正在使用ExpressionEngine作为我的网站的CMS。我已经创建了下面的一个.htaccess:为什么我的网站有我的网址?已更改.htaccess

<IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteBase/

    # Removes index.php from ExpressionEngine URLs 
    RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC] 
    RewriteCond %{REQUEST_URI} !/system/.* [NC] 
    RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L] 

    # Directs all EE web requests through the site index file 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.*)$ /index.php?/$1 [L] 

    RewriteCond $1 !\.(gif|jpe?g|png)$ [NC] 
    RewriteCond %{HTTP_HOST} ^www.gsmastersinc.com$ [NC] 
    RewriteRule ^(.*)$ http://gsmastersinc.com/$1 [R=301,L] 
</IfModule> 

为什么我所有的网址我的网站有一个?在他们中?防爆。 myurl /?/接触。

你可以在这里看到我在说什么:http://gsmastersinc.com,然后点击任何导航链接。悬停时,只有在点击后才显示?。

我必须有?在第13行/index.php或链接被破坏后,我得到了404。

我一直在寻找一个答案整个上午,但所有出现的都与.NET或类似的东西有关。

感谢你的规则

回答

1

更改为了:

RewriteEngine On 
RewriteBase/

RewriteCond $1 !\.(gif|jpe?g|png)$ [NC] 
RewriteCond %{HTTP_HOST} ^www.gsmastersinc.com$ [NC] 
RewriteRule ^(.*)$ http://gsmastersinc.com/$1 [R=301,L] 
# Removes index.php from ExpressionEngine URLs 
RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC] 
RewriteCond %{REQUEST_URI} !/system/.* [NC] 
RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L] 

# Directs all EE web requests through the site index file 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ /index.php?/$1 [L] 

总体保持你的301个规则之前内部重写规则。

+0

男人,我不确定除了顺序以外有什么不同,但你的解决方案完美地工作。非常感谢! –

+0

是的,由于301规则出现在底部,它重定向了内部重写的URL。 – anubhava

相关问题