2017-05-26 105 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