我在我的drupal站點example.com並在我的本地系統中配置我創建了一個新的文件夾drupal並粘貼了該文件夾中的所有文件。在drupal中重定向文件的文件夾路徑
當我加載我的網站在/ localhost/drupal其加載但圖像不加載,因爲它指向內容中的/localhost/sites/default/files/test.jpg ...我不能去和改變所有的內容...
我們設置的.htaccess採取一切圖像路徑/localhost/drupal/sites/default/files/test.jpg
<img alt="" src="/sites/default/files/finsoft-logo.png" style="width: 164px; height: 45px; ">
我想這樣的,但它不是玩具
RewriteRule ^/sites/default/files/(.*)$ /drupal/sites/default/files/$1 [L,NC]
下面是我在.htaccess文件
# Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI}
請幫我解決這個問題的代碼...
不,它不工作...我有像這樣的網址的圖像
,這裏的圖像url不會重定向到/ drupal/sites/.. –
您是否將此規則作爲第一條規則放入.htaccess中?也可以嘗試:'RewriteRule^sites/default/files /(.*)$/drupal/sites/default/files/$ 1 [L,NC,R]' – anubhava
沒有它的不工作....我放置了這個重寫規則之後「RewriteEngine On」行... –