我正在尝试从网址中删除/上传。我遵循了许多例子,但没有一个能够奏效。
我认为这个是最接近的,应该可以正常工作,但一切都没有发生。
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
答案 0 :(得分:1)
尝试替换此行:
RewriteRule ^/uploads/(.+)$ /$1 [QSA]
用这个:
RewriteRule ^(.*?)/?uploads(.*)$ /$1$2 [L]