.htaccess htaccess-图像url重写

.htaccess htaccess-图像url重写,.htaccess,codeigniter,mod-rewrite,rewrite,.htaccess,Codeigniter,Mod Rewrite,Rewrite,我需要重写我的图片网址,以更好地搜索引擎优化使用Timthumb 我有这个htaccess文件(在Codeigniter上),它可以工作,但当我经过一个重写的url时,它重定向到: 是否可以在不重定向的情况下重写? 谢谢 -- 我的htaccess文件是: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^(products)/(.*)-([0-9]{1,4})x([0-9]{1,4}).

我需要重写我的图片网址,以更好地搜索引擎优化使用Timthumb

我有这个htaccess文件(在Codeigniter上),它可以工作,但当我经过一个重写的url时,它重定向到:

是否可以在不重定向的情况下重写? 谢谢

-- 我的htaccess文件是:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /    
RewriteRule ^(products)/(.*)-([0-9]{1,4})x([0-9]{1,4}).(jpg) http://www.example.com/resize/timthumb.php?src=http://www.example.com/uploads/$2.$5&w=$3&h=$4 [R=301,L]

RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]

</IfModule>

重新启动发动机
重写基/
重写规则^(产品)/(.*)-([0-9]{1,4})x([0-9]{1,4})。(jpg)http://www.example.com/resize/timthumb.php?src=http://www.example.com/uploads/$2.$5&w=$3&h=$4[R=301,L]
重写COND%{REQUEST_URI}^系统*
重写规则^(.*)$/index.php?/$1[L]
重写cond%{REQUEST_URI}^应用程序*
重写规则^(.*)$/index.php?/$1[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)$index.php?/$1[L]

如果htaccess文件与目标位于同一服务器上(例如
www.example.com
),则需要从规则中删除主机/方案和
R
标志:

RewriteRule ^(products)/(.*)-([0-9]{1,4})x([0-9]{1,4}).(jpg) /resize/timthumb.php?src=http://www.example.com/uploads/$2.$5&w=$3&h=$4 [L]
RewriteRule ^(products)/(.*)-([0-9]{1,4})x([0-9]{1,4}).(jpg) http://www.example.com/resize/timthumb.php?src=http://www.example.com/uploads/$2.$5&w=$3&h=$4 [P,L]
如果它们不在同一台服务器上,则需要反向代理,这意味着您必须加载mod_proxy。您只需将
R
标志替换为
p
标志:

RewriteRule ^(products)/(.*)-([0-9]{1,4})x([0-9]{1,4}).(jpg) /resize/timthumb.php?src=http://www.example.com/uploads/$2.$5&w=$3&h=$4 [L]
RewriteRule ^(products)/(.*)-([0-9]{1,4})x([0-9]{1,4}).(jpg) http://www.example.com/resize/timthumb.php?src=http://www.example.com/uploads/$2.$5&w=$3&h=$4 [P,L]

只需删除规则末尾的
R=301,
。@HashemQolami隐式删除规则目标的
http://
部分redirects@JonLin啊,对了,我错过了。