我正在尝试从 url 中删除 /uploads 。我遵循了许多示例,但没有一个有效。
我认为这是最接近的,应该可以正常工作,但什么也没发生。
RewriteRule ^/uploads/(.+)$ /$1 [QSA]
这是我在 htaccess 中的内容
# Enable URL rewriting for pretty URLs
php_flag magic_quotes_gpc off
<FilesMatch "\.(?i:pdf)$">
ForceType application/octet-stream
Header set Content-Disposition attachment
</FilesMatch>
RewriteEngine on
RewriteBase /
RewriteRule ^/uploads/(.+)$ /$1 [QSA]
RewriteRule !\.(php|js|ico|gif|jpg|png|css|html|cgi|pdf|doc|xls|docx|xlsx|ppt|tff|svg|eot|woff|swf|mp3|wma|wav|MP4|AIFF|AAC|m4a|m4p|AVI|MOV|MPG|MPEG)$ index.php [NC]
#RedirectMatch ^/$ /misc/offline.php [NC]
我应该从: http ://example.com/storage/uploads/droom.pdf 到: http ://example.com/storage/droom.pdf