我在codeigniter wiki中找不到mod_rewrite了?它去了哪里?我试着看link,但它不在这里了。
答案 0 :(得分:1)
mod_rewrite是apache web服务器的一部分,它不是codeigniter的一部分,你用来编写SEO友好网址的扩展名
查看此链接,这将有助于您编写搜索引擎友好的网址
检查mod_rewrite是否加载或者只是放入空的php文件phpinfo()在浏览器中调用该文件并搜索mod_rewrite以使其在apache web服务器conf目录中搜索apache httpd.conf如果用#评论#只需删除它并重新启动Web服务器,再次加载服务器调用phpinofo并搜索mod_rewrite
答案 1 :(得分:1)
您的.htaccess
应该是这样的:
<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>