Here is my htaccess file:
Options +FollowSymLinks
RewriteEngine On
AcceptPathInfo On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L,QSA]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.domain.com/%2 [L,R=301]
Here is my site structure:
error_log
lib/
mail/
public_html/
www/
access-logs/
etc/
The .htaccess
file is located inside public_html
Inside public_html
I have /assets
, /images
and /uploads
:
The rules redirect ok for /assets and /images but for :
http://www.domain.com/uploads/100_100/2014/10/24/5/0/841453939422001907988782-1-100_100.jpg
Redirects to www.domain.com.
EDIT: Entry from access_log below:
ip - - [24/Oct/2014:17:54:37 +0300] "GET /uploads/100_100/2014/10/13/d/2/80550090151440232989044-1-100_100.jpg HTTP/1.1" 301 20 "http://www.domain.com/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Ch$
Any ideas why?
Problem seems to be in your redirect rule:
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [NE,L,R=301]
Also keep this rule just below RewriteBase
line.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.