dsfdgdsfd23212 2015-02-26 05:45
浏览 86
已采纳

如何从GoDaddy子文件夹中的CodeIgniter站点中删除index.php?

I need to know what do I have to do on the config.php file and in the .htaccess file in order to be able to remove the index.php path from my CodeIgniter site that is installed in a subfolder like this:

jeanpaulruizvallejo.com/proyectos/pruebas/ci-rest-api/

Right now I can open URL's like this one:

jeanpaulruizvallejo.com/proyectos/pruebas/ci-rest-api/index.php?blog/comments

... but it should be like:

jeanpaulruizvallejo.com/proyectos/pruebas/ci-rest-api/blog/comments

Any ideas on how to solve this?

Thanks in advance for your help!

  • 写回答

2条回答 默认 最新

  • douji9816 2015-02-27 19:51
    关注

    So, finally this is what worked for me, hope it helps somebody.

    The .htaccess file:

    RewriteEngine On
    RewriteBase /proyectos/pruebas/ci-rest-api/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
    

    The config.php file looks like this:

    <?php
    defined("BASEPATH") OR exit("No direct script access allowed");
    
    $config["base_url"] = "http://jeanpaulruizvallejo.com/proyectos/pruebas/ci-rest-api/";
    
    $config["index_page"] = "";
    
    $config["uri_protocol"] = "QUERY_STRING";
    
    $config["url_suffix"] = "";
    
    $config["language"] = "english";
    
    $config["charset"] = "UTF-8";
    
    $config["enable_hooks"] = FALSE;
    
    $config["subclass_prefix"] = "MY_";
    
    $config["composer_autoload"] = FALSE;
    
    $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";
    
    $config["log_threshold"] = 0;
    
    $config["log_path"] = "";
    
    $config["log_file_extension"] = "";
    
    $config["log_file_permissions"] = 0644;
    
    $config["log_date_format"] = "Y-m-d H:i:s";
    
    $config["error_views_path"] = "";
    
    $config["cache_path"] = "";
    
    $config["cache_query_string"] = FALSE;
    
    $config["encryption_key"] = "";
    
    $config["sess_driver"] = "files";
    $config["sess_cookie_name"] = "ci_session";
    $config["sess_expiration"] = 7200;
    $config["sess_save_path"] = NULL;
    $config["sess_match_ip"] = FALSE;
    $config["sess_time_to_update"] = 300;
    $config["sess_regenerate_destroy"] = FALSE;
    
    $config["cookie_prefix"] = "";
    $config["cookie_domain"] = "";
    $config["cookie_path"] = "/";
    $config["cookie_secure"] = FALSE;
    $config["cookie_httponly"] = FALSE;
    
    $config["standardize_newlines"] = 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["csrf_regenerate"] = TRUE;
    $config["csrf_exclude_uris"] = array();
    
    $config["compress_output"] = FALSE;
    
    $config["time_reference"] = "local";
    
    $config["rewrite_short_tags"] = FALSE;
    
    $config["proxy_ips"] = "";
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 yolov8边框坐标
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂