0

我的 htaccess 有问题。

当我使用此网址 www.example.com/test 或 example.com/teste/ 时,一切正常,但是当我使用类似 example.com/test 的网址时,它会重定向到 example.comtest 。

我真的不明白为什么!

这是我的htaccess:

<IfModule mod_security.c>
# Turn off mod_security filtering.
SecFilterEngine Off

# The below probably isn't needed, but better safe than sorry.
SecFilterScanPOST Off
</IfModule>

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# If your server is running PHP in CGI mode you will probably need to uncomment the following lines
# Only uncomment lines that begine with Rewrite

# The RewriteBase should be set to the same value as the AppPath setting in your config.php WITH a / on the end
# RewriteBase /

# This rewrite base rule is only required if you are getting 401 unauthorized errors when placing an order with Google Checkout
# RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]
#
# Alternatively, if the above does not work, try uncommenting this line below instead:
# SetEnvIfNoCase Authorization "Basic ([a-z0-9=]+)" REMOTE_AUTHORIZATION=$1

RewriteRule .* - [E=HTTP_IF_MODIFIED_SINCE:%{HTTP:If-Modified-Since}]
RewriteRule .* - [E=HTTP_IF_NONE_MATCH:%{HTTP:If-None-Match}]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ http://www.example.com/ [R=301,L]
RewriteRule ^([^\.]+[^/])$ http://%{HTTP_HOST}/$1/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1  
RewriteCond %{REQUEST_URI}\\/%{HTTP_HOST}/www. ^/+(.+/)?[^.]*[^/]\\(/)([^w][^w][^w][^.].*/(www\.)¦.*)$ [OR,NC]
RewriteCond %{HTTP_HOST}/www. ^(/)?(/)?([^w][^w][^w][^.].*/(www\.))$ [NC]
RewriteCond $1 !^(blogg|admin|emailmarketer|favicon\.ico|robots\.txt|index\.php) [NC]
RewriteRule ^ http://%4%{HTTP_HOST}%{REQUEST_URI}%2 [L,R=301] 

<IfModule mod_env.c>
    SetEnv SEO_SUPPORT 1
</IfModule>
</IfModule>

<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE application/x-javascript text/css text/html text/xml
</IfModule>
4

1 回答 1

0

我的猜测是

RewriteRule ^ http://%4%{HTTP_HOST}%{REQUEST_URI}%2 [L,R=301] 

应该

RewriteRule ^ http://%4%{HTTP_HOST}%{REQUEST_URI}/%2 [L,R=301] 
于 2011-10-17T17:47:19.307 回答