-1

我在 codeigniter wiki 中找不到 mod_rewrite 了吗?它去哪儿了?我试着查看这个链接,但它不再在这里了。

4

2 回答 2

1

mod_rewrite 是 apache web 服务器的一部分,它不是 codeigniter 的一部分,这个扩展用于编写 SEO 友好的 url

看看这个链接,这将帮助您编写搜索引擎友好的网址

SEO友好的网址

检查 mod_rewrite 是否已加载或不只是放入空的 php 文件 phpinfo() 在浏览器中调用该文件并搜索 mod_rewrite 以启用它 在您的 apache Web 服务器 conf 目录中搜索 apache httpd.conf 如果它被注释为 # 只需删除它并在再次加载服务器调用 phpinofo 并搜索 mod_rewrite 后重新启动您的 Web 服务器

于 2013-02-12T07:48:29.697 回答
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>
于 2013-02-12T08:31:38.590 回答