2014-01-15 61 views
0

最近我們轉移到一個新的託管服務器。在那裏我們的網站沒有運行;它只是顯示一個空白頁面,CodeIgniter新服務器的URL重定向問題

這裏是我的.htaccess文件

RewriteEngine on 

#RewriteCond %{REQUEST_URI} !=/maintenance.html 
#RewriteRule^/maintenance.html [R=301] 

RewriteCond %{REQUEST_FILENAME} !-f 

RewriteCond %{REQUEST_FILENAME} !-d 

RewriteRule ^(.*)$ index.php/$1 [L,QSA] 


<IfModule mod_expires.c> 

    ExpiresActive On 

    ExpiresByType text/html "access plus 10 seconds" 

    ExpiresByType image/gif "access plus 10 years" 

    ExpiresByType image/jpeg "access plus 10 years" 

    ExpiresByType image/png "access plus 10 years" 

    ExpiresByType image/x-icon "access plus 10 years" 

    ExpiresByType text/css "access plus 10 years" 

    ExpiresByType text/javascript "access plus 10 years" 

    ExpiresByType application/x-javascript "access plus 10 years" 

    ExpiresByType application/x-shockwave-flash "access plus 10 years" 

</IfModule> 

<IfModule mod_rewrite.c> 

    RewriteEngine On 
    RewriteBase/


    RewriteRule ^(welcome(/index)?|index(\.php)?)/?$/[L,R=301] 
    RewriteRule ^(.*)/index/?$ $1 [L,R=301] 


    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.+)/$ $1 [L,R=301] 


    RewriteCond %{REQUEST_URI} ^system.* 
    RewriteRule ^(.*)$ /index.php/$1 [L] 


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

</IfModule> 

<IfModule !mod_rewrite.c> 

    ErrorDocument 404 /index.php 

</IfModule> 
#RedirectMatch \.(dynamiccontent|pl|plx|perl|cgi|php|php4|php4|php6|php3|shtml)$... 

這裏是我的config.php文件:

<?php 
    if (! defined('BASEPATH')) 
     exit('No direct script access allowed'); 
    $config['base_url'] = 'http://tollywood.net/'; 
    $config['index_page'] = ""; 
    $config['uri_protocol'] = 'REQUEST_URI'; 
    $config['url_suffix'] = '.htm'; 
    $config['language'] = 'english'; 
    $config['charset'] = 'UTF-8'; 
    $config['enable_hooks'] = FALSE; 
    $config['subclass_prefix'] = 'MY_'; 
    $config['permitted_uri_chars'] = 'a-z 0-9~%.:_\(\)\-\'\ \,\+'; 
    $config['allow_get_array']  = TRUE; 
    $config['enable_query_strings'] = FALSE; 
    $config['controller_trigger'] = 'c'; 
    $config['function_trigger']  = 'm'; 
    $config['directory_trigger'] = 'd'; // experimental not currently in use 
    $config['log_threshold'] = 0; 
    $config['log_path'] = ''; 
    $config['log_date_format'] = 'Y-m-d H:i:s'; 
    $config['cache_path'] = ''; 
    $config['encryption_key'] = 'abcdefgh1234'; 
    $config['sess_cookie_name']  = 'ci_session'; 
    $config['sess_expiration']  = 7200; 
    $config['sess_expire_on_close'] = FALSE; 
    $config['sess_encrypt_cookie'] = FALSE; 
    $config['sess_use_database'] = FALSE; 
    $config['sess_table_name']  = 'ci_sessions'; 
    $config['sess_match_ip']  = FALSE; 
    $config['sess_match_useragent'] = TRUE; 
    $config['sess_time_to_update'] = 300; 
    $config['cookie_prefix'] = ""; 
    $config['cookie_domain'] = ""; 
    $config['cookie_path']  = "/"; 
    $config['cookie_secure'] = FALSE; 
    $config['global_xss_filtering'] = FALSE; 
    $config['csrf_protection'] = FALSE; 
    $config['csrf_token_name'] = 'csrf_test_name'; 
    $config['csrf_cookie_name'] = 'csrf_cookie_name'; 
    $config['csrf_expire'] = 7200; 
    $config['compress_output'] = FALSE; 
    $config['time_reference'] = 'local'; 
    $config['rewrite_short_tags'] = FALSE; 
    $config['proxy_ips'] = ''; 

    /* End of file config.php */ 

    /* Location: ./application/config/config.php */ 

在我試過的config.php文件使用新的IP地址更改基準URL。然後它也不起作用。

http://ipaddress/~tollywoo/ If we type this in the browser, it is showing a blank page 

http://ipaddress/~tollywoo/index.php/News.htm here it is working 

我怎樣才能解決這個問題呢?

回答

0

嘗試將您的重寫基地從/更改爲/~tollywoo/

此外,最底層的規則可能無法執行,因爲頂部的第一條規則將所有內容路由到index.php,這將繞過其他規則嘗試執行的所有操作。

0

試試這個的.htaccess:

<IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteBase/

    RewriteCond %{REQUEST_URI} ^sys.* 
    RewriteRule ^(.*)$ /index.php?/$1 [L] 

    RewriteCond %{REQUEST_URI} ^app.* 
    RewriteRule ^(.*)$ /index.php?/$1 [L] 

    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.*)$ index.php?/$1 [L] 
</IfModule> 
<IfModule !mod_rewrite.c> 
    ErrorDocument 404 /index.php 
</IfModule> 

假設的index.php是你的索引頁。

,並更改config.php文件:

$config['index_page'] = ''; 
+0

我們嘗試這樣做,我們得到一個空白頁 – user3196944