cannot find mod_rewrite for codeigniter [closed]

不打扰是莪最后的温柔 提交于 2019-12-13 07:52:22

问题


I cannot find the mod_rewrite in the codeigniter wiki anymore? where did it go? I tried looking at this link but its not in here anymore.


回答1:


mod_rewrite is part of apache web server it not part of codeigniter this extension you use to write SEO friendly url

have look on this link which will help you to write search engine friendly urls

SEO friendly urls

to check mod_rewrite is loaded or not just put in empty php file phpinfo() call that file in browser and search for mod_rewrite to enable it search for apache httpd.conf on your apache web server conf directory if it is commented with # just remove it and restart your web server after loading server call again phpinofo and search for mod_rewrite




回答2:


Your .htaccessshould look something like this:

<IfModule mod_rewrite.c>
RewriteEngine On
#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?/$1 [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?/$1 [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?$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
 ErrorDocument 404 index.php
</IfModule>


来源:https://stackoverflow.com/questions/14827335/cannot-find-mod-rewrite-for-codeigniter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!