开发者

.htaccess url rewrite

I want to rewrite a URL.

Let's say you visit http:开发者_高级运维//files.domain.com/uploads/file_name.jpg

How can I use htaccess to write it so I can access it via http://files.domain.com/file_name.jpg?

Thanks.


Try putting following lines in your root .htaccess file

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} ^/[^/]*\.jpg [NC]
RewriteRule ^([^/]*\.jpg)$ /uploads/$1 [L,NC] 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜