Codeigniter URL重写以删除index.php和子文件夹不工作?
所以我浏览了dreamhost、codeingiter等之间的几十个论坛帖子和网站 我在dreamhost上托管的codeigniter中设置了一个文件目录,如下所示:Codeigniter URL重写以删除index.php和子文件夹不工作?,codeigniter,url-rewriting,dreamhost,Codeigniter,Url Rewriting,Dreamhost,所以我浏览了dreamhost、codeingiter等之间的几十个论坛帖子和网站 我在dreamhost上托管的codeigniter中设置了一个文件目录,如下所示: mysite.com - application - system - user_guide - .htaccess 我可以访问的实时站点是: mysite.com/index.php/site/WhatIwantToKeep 我的.htaccess文件读取: RewriteEngine on RewriteBase
mysite.com
- application
- system
- user_guide
- .htaccess
我可以访问的实时站点是:
mysite.com/index.php/site/WhatIwantToKeep
我的.htaccess
文件读取:
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]
目前如果我去mysite.com/site/WhatIwantToKeep它找不到它
如果我放置任何IfModule
标记或选项行,它将给出服务器500错误
理想情况下,此代码将重写它,以便我的URL能够读取:
mysite.com/WhatIwantToKeep
我在
.htaccess
文件中使用以下内容。试一试:
RewriteEngine on
RewriteCond $1 !^([a-zA-z0-9/])
RewriteRule ^(.*)$ index.php [L]
RewriteCond $1 !^(index.php|images|robots.txt|system|assets|files)
RewriteRule ^(.*)$ index.php?$1 [QSA,L]
你的路由器,codeigniter配置上的默认控制器设置怎么样?是的,给我们看看你的routes.php文件。