htaccess:拒绝除特定域以外的直接访问

时间:2014-07-03 13:08:28

标签: php apache .htaccess mod-rewrite

http://example.com/upload/aaa.jpg to
http://example.com/asset/example.com/aaa.jpg

~~

RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$
RewriteRule ^upload/(.*)$ asset/%1/$1 [L]

它有效,但我只想让example.com中的ppl直接访问

http://example.com/asset/example.com/aaa.jpg

eg: http://aa.com only can access 
http://aa.com/asset/example.com/xxxx.jpg

我该怎么做?

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /asset/sss.ssss.com/

RewriteCond %{HTTP_HOST} !^sss\.ssss\.com$ [NC]
RewriteRule ^ - [F]

这是我的解决方案

0 个答案:

没有答案