Reputation: 2247
I'm ashamed for having to ask this becous there is soooo many questions and answers out there about this but I have search and tried for weeks without positive results.
I have file upload page with the url: files.example.com
When a user is uploading a file its placed in a subdir: files.example.com/files/file.jpg So when a user is going to view the file, he has to visit that url.
But I want to remove the dir files/ So the user can view the file with this url: files.example.com/file.jpg
I have placed a .htaccess file in: files.example.com/.htaccess
And tried everything i can find. Ex.:
RewriteEngine On
RewriteBase /
RewriteRule ^files/?(.*)$ /$1
mod_rewrite subdomain + dir
Upvotes: 1
Views: 351
Reputation: 11556
Your rule is the wring way round. Try:
RewriteEngine On
RewriteBase /
RewriteRule ^([^/]*\.jpg)$ files/$1 [L]
Upvotes: 1