How do I write a .htaccess file to make CodeIgniters URL routing work?

后端 未结 9 1148
死守一世寂寞
死守一世寂寞 2020-12-01 01:13

I\'m running a LAMP environment with CodeIgniter. I want to be able to use its URL pattern, like, http://localhost/controller/function/ID, but by default it has

9条回答
  •  情话喂你
    2020-12-01 01:37

    
    RewriteEngine on
    RewriteBase /
    
    # Removes the "/" at the end
    RewriteRule (.+)/$ /$1 [L,R]
    
    RewriteCond $1 !^(index\.php|dhtml|img|css|js|favicon\.ico|robots\.txt)
    RewriteRule ^([^?&]+) /index.php/$1 [L]
    
    

提交回复
热议问题