2017-05-26 113 views
1

我想重寫.htaccess文件的URL,嘗試了很多,但最終感到沮喪。.htaccess重定向URL與加載的CSS,JS和圖像

的.htaccess

<IfModule mod_rewrite.c> 
<IfModule mod_negotiation.c> 
    Options -MultiViews 
</IfModule> 
     RewriteEngine On 
     RewriteCond %{REQUEST_FILENAME} !-d 
     RewriteCond %{REQUEST_FILENAME} !-f 
     RewriteCond ^suba/?$ resources/uploads/releases/zipfiles/1484883480/index\.html [NC, C] 
     RewriteRule^index.php [L] 

我只是想開this像這樣的短網址,使之更加搜索引擎友好,
http://dittmagasin.no/release

我已經提到了以下職位:

  1. URL rewriting with PHP
  2. URL rewriting for beginners

任何幫助將不勝感激。 感謝

回答

1

您可以使用:

RewriteEngine On 

RewriteRule ^release/?$ resources/uploads/releases/zipfiles/1484883480/index.html [NC,L] 

RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule^index.php [L] 
+0

http://dittmagasin.no/release,那並不加載CSS,JS和圖片。你能幫我一下嗎? –

+0

你可以注意到http://dittmagasin.no/release和http://dittmagasin.no/resources/uploads/releases/zipfiles/1484883480/index.html –

+0

之間的區別這是因爲你的css/js中的相對路徑/圖片。您需要在頁面的HTML部分下方添加下面的內容:「' – anubhava