签RewriteBase
入.htaccess
文件。就像下面
RewriteBase /your project folder name/
复制以下代码并将其粘贴到您的.htaccess
文件中
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
RewriteBase /codeigniter/
#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]
#RewriteRule ^page/(.*)$ index.php?/#$1 [R=301,L,NE]
# 如果我们没有安装 mod_rewrite,所有 404 的 # 都可以发送到 index.php,一切正常。# 提交人:ElliotHaughin
ErrorDocument 404 /index.php;
希望它会帮助你。并检查一件事,即您的网址。如果有任何 ~ 符号,则.htaccess
文件将有所不同。否则上面的代码将起作用。谢谢。