質問

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

役に立ちましたか?

解決

Your rule is the wring way round. Try:

RewriteEngine On
RewriteBase /
RewriteRule ^([^/]*\.jpg)$ files/$1 [L]
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top