2012-06-16 20 views
1

我的根htaccess的使用這個htaccess的重定向,如果一個特定的文件夾犯規存在

RewriteEngine on 
Options +FollowSymLinks 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-l 
RewriteRule .* index.php?p=%{REQUEST_URI} [L] 

這改寫http://example.com/notexistsfolder成功

但我想也重定向http://example.com/user/notexistsfolderhttp://example.com/notexistsfolder

什麼代碼應我補充實現這一目標?

回答

0

這裏是您在.htaccess需要DOCUMENT_ROOT目錄下的代碼:

Options +FollowSymLinks -MultiViews 
# Turn mod_rewrite on 
RewriteEngine On 
RewriteBase/

## If the request is for a valid directory 
RewriteCond %{REQUEST_FILENAME} -d [OR] 
## If the request is for a valid file 
RewriteCond %{REQUEST_FILENAME} -f [OR] 
## If the request is for a valid link 
RewriteCond %{REQUEST_FILENAME} -l 
## don't do anything 
RewriteRule^- [L] 

RewriteRule ^user/(.*)$ $1 [L,NC] 

RewriteRule (?!^user/)^(.*)$ index.php?p=$1 [L,NC,QSA] 
相關問題