2012-01-30 110 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检查现有目录

希望有所帮助。