2012-01-30 109 views
0

我試圖創造一些Apache的htaccess的規則 short.com/ASWi7 - > short.com/index.php?h=ASWi7的網址縮短

所以我嘗試使用我的htaccess這段代碼

RewriteEngine on 
RewriteCond %{REQUEST_URI} !^/index.php 
RewriteRule ^(.*)$ /index.php?hash=$1 [L] 

,但該網站失去了CSS和一切......我組織我的文件夾等網站... 所以我怎樣才能排除所有的文件夾或某類文件是規則的一部分?

回答

2

嘗試以下操作:

RewriteEngine on 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_URI} !^/index.php 
RewriteRule ^(.*)$ /index.php?hash=$1 [L] 

!-f檢查現有文件

!-d檢查現有目錄

希望有所幫助。