【发布时间】:2018-06-01 01:26:56
【问题描述】:
这是我的虚拟主机:
<VirtualHost *:8080>
ServerAdmin webmaster@dummy-host.localhost:8080
DocumentRoot "D:/test/testpage/"
ServerName testpage
ServerAlias testpage.localhost
ErrorLog "logs/testpage-error.log"
CustomLog "logs/testpage-access.log" common
</VirtualHost>
系统/主机
127.0.0.1 testpage.localhost
xampp/apache/conf/中的httpd.conf
Listen 8080
ServerName localhost:8080
LoadModule rewrite_module modules/mod_rewrite.so
<Directory />
AllowOverride All
Require all granted
</Directory>
我在 testpage 文件夹中的 .htaccess 文件
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
在我的应用程序/config/config.php 中
$config['base_url'] = 'http://testpage.localhost:8080';
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';
我面临的唯一问题是 index.php,我可以访问我的其他页面,但它在 base_url() 和视图之间有 index.php。
【问题讨论】:
-
将您的 .htaccess 文件放在项目文件夹中,而不是在应用程序文件夹中
-
我的 .htaccess 在同一级别的应用程序文件夹中,而不是在应用程序文件夹内。
标签: php .htaccess codeigniter codeigniter-3