CodeIgniter removing index.php from url

前端 未结 30 1395
[愿得一人]
[愿得一人] 2020-11-21 11:51

My current urls look like this [mysite]index.php/[rest of the slug].
I want to strip index.php from these urls.

mod_rewrite

30条回答
  •  清酒与你
    2020-11-21 11:57

    Minor thing: (Optional)

    Try restarting your Apache after updating the rewrite engine status in vhosts as Rewrite ON.

    One critical thing to notice:

    In Apache vhosts file, check whether you have this script line AllowOverride None If yes, please remove/comment this line.

    My vhosts file script: (Before)

    
        DocumentRoot "/path/to/workspace"
        ServerName ciproject
        ErrorLog "/path/to/workspace/error.log"
        CustomLog "/path/to/workspace/access.log" common
        Directory   "/path/to/workspace">
            Options Indexes FollowSymLinks
            AllowOverride None
            Order allow,deny
            Allow from all
         
    
    

    My vhosts file script: (After)

    
        DocumentRoot "/path/to/workspace"
        ServerName ciproject
        ErrorLog "/path/to/workspace/error.log"
        CustomLog "/path/to/workspace/access.log" common
        Directory   "/path/to/workspace">
            Options Indexes FollowSymLinks
            #AllowOverride None
            Order allow,deny
            Allow from all
         
    
    

    I faced the same problem, struggled for around 1 day, all were fine. Later, by trial and error method, found this thing. After removing this, my job was accomplished. The URL now does not look up for index.php :)

提交回复
热议问题