【发布时间】:2021-12-15 02:42:56
【问题描述】:
我已经阅读了多个主题,与遇到类似问题的人一起阅读,但似乎没有一个解决方案对我有用。我的网站托管在 http://localhost/mysite/。
我有一个 codeigniter 站点并且正在使用 XAMPP。
任何时候我想访问我在 url 中有 index.php 的页面(http://localhost/mysite/index.php/newpage 或 http://localhost/mysite/index.php/anothernewpage)
这是我的 .htaccess 文件
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
这是我的配置文件
$config['base_url'] = "http://localhost";
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';
这是我的路线
$route['default_controller'] = 'welcome';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
我还在我的 httpd.conf 文件 (XAMPP) 中取消了以下行的注释
LoadModule rewrite_module modules/mod_rewrite.so
如果我尝试访问站点的某个区域而不包括 index.php (http://localhost/mysite/newpage),我会收到错误 404 在此服务器上找不到请求的 URL。我必须输入完整的 url http://localhost/mysite/index.php/newpage。谁能帮我弄清楚这个设置有什么问题?
【问题讨论】:
-
请提供您的文件夹结构
标签: php .htaccess codeigniter xampp