代码点火器删除索引.php同时在 xampp 上的虚拟主机上工作



我以前的文件夹树是(使用便携式xampp):(例如在D:驱动器根目录上工作)

/xampp/htdocs/application
/xampp/htdocs/system
/xampp/htdocs/themes
/xampp/htdocs/index.php etc..

现在我正在尝试转变为一种可以处理多个项目的结构,因此新树:

/xampp/htdocs
/web_projects/project-name/codeigniter/application
/web_projects/project-name/codeigniter/system
/web_projects/project-name/htdocs/themes
/web_projects/project-name/htdocs/index.php

我在 htdocs 中的 htaccess 文件:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index.php|robots.txt)
# if Serves works on Linux OS
RewriteRule ^(.*)$ index.php/$1
# if Server works on Windows OS
# RewriteRule ^(.*)$ index.php?/$1
RewriteCond %{REQUEST_FILENAME} !-f
# if Serves works on Linux OS
RewriteRule ^(application|modules|plugins|system|themes|library|files) index.php/$1 [L]
# if Server works on Windows OS
# RewriteRule ^(application|modules|plugins|system|themes|library|files) index.php?/$1 [L]

httpd-vhosts.conf

NameVirtualHost *:8080
<VirtualHost *:8080>
    DocumentRoot "/xampp/htdocs"
    ServerName localhost
    <Directory "/xampp/htdocs">
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>
<VirtualHost *:8080>
    DocumentRoot "/web_projects"
    ServerName welcome.localhost
    <Directory "/web_projects">
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>
<VirtualHost *:8080>
    DocumentRoot "/web_projects/test/htdocs"
    ServerName test.localhost
    <Directory "/web_projects/test/htdocs">
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

最后等/主机

127.0.0.1 localhost
127.0.0.1 welcome.localhost
127.0.0.1 test.localhost
127.0.0.1 vstart # Alias for test

所有虚拟主机都在工作,即 http://vstart:8080/ 在工作,但代码点火器在地址行中没有索引.php就无法运行,因此路由无法正常工作。

我的配置/配置.php文件是:

$config['base_url'] = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "https" : "http");
$config['base_url'] .= "://".$_SERVER['HTTP_HOST'];
$config['base_url'] .= str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);
$config['index_page'] = '';

这组在我以前的文件夹树中运行顺利,现在不起作用。我挖掘互联网以找到失败的解决方案。

有没有外在的眼睛可以捕捉到我做错的地方?

找到了解决方案:

我需要做的就是将"全部允许覆盖"添加到受人尊敬的虚拟主机中。

希望在未来帮助某人。

新项目应该放在"htdocs"的文件夹中

例:

xampp/htdocs/new_project1/index.htm

Xampp/HTDOCS/new_project1/CSS

Xampp/HTDOCS/new_project1/Images

xampp/htdocs/new_project2/index.htm

xampp/htdocs/new_project2/CSS

Xampp/HTDOCS/new_project2/Images

最新更新