2012-10-19 49 views
0

我想顯示上傳的圖片和視頻的短網址users.if用戶下載圖片,他們沒有得到的照片和videos.users的實際路徑無法知道圖片和視頻的實際位置。請讓我知道我如何在wordpress中做到這一點?這可能在htaccess文件中?短上傳的圖片和視頻網址在wordpress

例如, http://example.com/images/pic.jpg

我想要。

http://example.com/pic.jpg

+0

你的目標是什麼,爲什麼你需要它? –

+0

我想隱藏來源的確切位置 –

回答

0
  1. 您必須只露出短網址。所有這些圖像的鏈接,但看起來像http://example.com/pic.jpg表格。

  2. 您可以在內部通過檢查,如果存在這樣一個文件,然後在內部的瀏覽器重寫,因此URL重寫http://example.com/pic.jpg/images/pic.jpg仍然http://example.com/pic.jpg但他們從/images/pic.jpg服務的形象:

    RewriteEngine On 
    # check that it's an image 
    RewriteCond %{REQUEST_URI} \.(jpe?g|png|gif|bmp)$ [NC] 
    # check that the resource actually exists in the /images/ directory 
    RewriteCond %{DOCUMENT_ROOT}/images%{REQUEST_URI} -f 
    # internally rewrite: 
    RewriteRule^/images%{REQUEST_URI} [L]