2014-02-19 43 views
0

我寫了下面的htaccess重寫重定向到一個名爲index.php的所有重定向而不是從一個特定的文件夾或子文件夾它的.htaccess

RewriteEngine On 
    RewriteCond %{REQUEST_URI} !=/index.php 
    RewriteRule .* /index.php 

維護網頁的任何請求現在我想要一個文件夾上,我修復開發文件應該被排除在上面的通用重定向到index.php之外。我怎麼寫這個條件。我已經做到了,如:

RewriteCond %{REQUEST_URI} !=/xxxxxxxx-xxxx-xxx-xx/ 
### here xxxxxx-is the folder name 

我XXXXXX文件夾中的htaccess的從URL排除「的index.php」,使URL看起來很漂亮,但現在它給了我404服務器

# Turn on URL rewriting 
RewriteEngine On 

# If your website begins from a folder e.g localhost/my_project then 
# you have to change it to: RewriteBase /my_project/ 
# If your site begins from the root e.g. example.local/ then 
# let it as it is 
RewriteBase /xxxxxxxxx/ 

# Protect application and system files from being viewed when the index.php is missing 
RewriteCond $1 ^(application|system|private|logs) 

# Rewrite to index.php/access_denied/URL 
RewriteRule ^(.*)$ index.php/access_denied/$1 [PT,L] 

# Allow these directories and files to be displayed directly: 
RewriteCond $1  ^(index\.php|robots\.txt|favicon\.ico|public|assets|resources|css|js|images) 

# No rewriting 
RewriteRule ^(.*)$ - [PT,L] 

# Rewrite to index.php/URL 
RewriteRule ^(.*)$ index.php/$1 [PT,L] 

回答

0

你可以使用:

RewriteEngine On 

RewriteCond %{REQUEST_URI} !/(index.php|excluded-folder/) [NC] 
RewriteRule^/index.php [L] 
+0

我正在檢查這個.. – edam

+0

對不起。它給了我404.我在其中包含codeigniter應用程序的文件夾中的其他htaccess。我寫了條件來防止index.php不被顯示在url中?我應該編輯這個問題嗎? – edam

+0

如果你在'xxxxxx'裏有.htaccess,那麼這個文件夾會自動從根目錄的'/ index.php'跳過 – anubhava

相關問題