سؤال

I am having a problem with my htaccess.

when I use this url www.example.com/test or example.com/teste/ its all ok, but when I use a url like this example.com/test it redirects to example.comtest .

I am really cant understand why!

here it is my 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>
هل كانت مفيدة؟

المحلول

My guess would be that

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

should be

RewriteRule ^ http://%4%{HTTP_HOST}%{REQUEST_URI}/%2 [L,R=301] 
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top