去掉codeigniter地址中的index.
php版本:codeigniter_2.0.1希望ci 应用的url不包含index.php例如: http://www.example.com/index.php/product/712希望变成这样http://www.example.com/product/712这样url更漂亮,也许这样seo更友好,通过urlrewrite就可以实现只需用下面3个步骤就可以搞定:
1.建立.htaccess写入重写规则如下
[code]??? rewriteengine on??? rewritebase /??? #removes access to the system folder by users.??? #additionally this will allow you to create a system.php controller,??? #previously this would not have been possible.??? #'system' can be replaced if you have renamed your system folder.??? rewritecond %{request_uri} ^system.*??? rewriterule ^(.*)$ /index.php?/ [l]?????? #when your application folder isn't in the system folder??? #this snippet prevents user access to the application folder??? #submitted by: fabdrol??? #rename 'application' to your applications folder name.??? rewritecond %{request_uri} ^application.*??? rewriterule ^(.*)$ /index.php?/ [l]??? #checks to see if the user is attempting to access a valid file,??? #such as an image or css document, if this isn't true it sends the??? #request to index.php??? rewritecond %{request_filename} !-f??? rewritecond %{request_filename} !-d??? rewriterule ^(.*)$ index.php?/ [l]??? # if we don't have mod_rewrite installed, all 404's??? # can be sent to index.php, and everything works as normal.??? # submitted by: elliothaughin??? errordocument 404 /index.php?[/code]
2.设置$config['index_page']为空置
打开文件system/application/config/config.php把代码[php]$config['index_page'] = "index.php";[/php]改为[php]$config['index_page'] = '';[/php]
3.确保apache支持url重写,重启apache
PHP 8.5.5 PHP 8.5.5 是 PHP 8.5 分支的维护更新版本。该版本延续了“小步快跑”的迭代逻辑,通过深度错误修复、底层性能微调以及安全加固,旨在为开发者提供一个更健壮、更高效的运行环境。该版本严格遵守语义化版本规范,不包含破坏性变更。
下载
