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://file
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]