CodeIgniter Forums

Full Version: Codeigniter 4, Windows 10, XAMPP 7.2.2 HTTP.pageNotFound
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello Everyone

Just done the download of codeigniter 4 dev from https://github.com/bcit-ci/CodeIgniter4

I have on my PC Xampp 7.2.2 that i use for Local Development of basic things. Its working 100% for everything else but, apparently, nothing to do to have the classic codeigniter welcome page:

1) new folder codeigniter4dev (D:\xampp\htdocs\codeigniter4dev)
2) .htaccess at D:\xampp\htdocs\codeigniter4dev with:


Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^(.*)$ public/$1 [L]
</IfModule>

3)  edit App.php at D:\xampp\htdocs\codeigniter4dev\application\Config

previous value

Code:
    public $baseURL = '';


new value

Code:
    public $baseURL = 'http://localhost/codeigniter4dev/';


4) Result:

[Image: Immagine.png]


Advices ? Thanks in advance to everyone Big Grin
You will need Administrator roghts to do the below:

1) In Control Panel - Click on Programs Uninstall a program.
   On the left click on Turn Windows features on or off.

2) In the Dialog box find Internet Information Services and Information Services Hostable Web Core,
   un-check all if they are checked.


3) Check - C:\Windows\System32\drivers\etc\hosts - right click open with notepad.
   Check and make sure that localhost is set to either ::1 or 127.0.0.1

4) Control Panel\System and Security\System on the left click on Advanced system settings.
   Click on the bottom button Environment Variables.

5) on the bottom edit panel highlight the path variable and click the Edit... button.
   Add the paths to XAMPP, PHP and Composer and everything else you need.


I also use PhpStorm for my Editor and I have to add a new mapping to the public_html Directory
were index.php is.

public_html because that's what my hosting provider uses so it makes it easy to install

Personaly I use VHOST and add my own names to the host files.

1) Edit C:\xampp\apache\conf\extra\httpd-vhosts.conf to look like the below.

Code:
# Virtual Hosts
#
# Required modules: mod_log_config

# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.4/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ##ServerName or ##ServerAlias in any <VirtualHost> block.
#
##<VirtualHost *:80>
   ##ServerAdmin [email protected]
   ##DocumentRoot "C:/xampp/htdocs/dummy-host.example.com"
   ##ServerName dummy-host.example.com
   ##ServerAlias www.dummy-host.example.com
   ##ErrorLog "logs/dummy-host.example.com-error.log"
   ##CustomLog "logs/dummy-host.example.com-access.log" common
##</VirtualHost>

##<VirtualHost *:80>
   ##ServerAdmin [email protected]
   ##DocumentRoot "C:/xampp/htdocs/dummy-host2.example.com"
   ##ServerName dummy-host2.example.com
   ##ErrorLog "logs/dummy-host2.example.com-error.log"
   ##CustomLog "logs/dummy-host2.example.com-access.log" common
##</VirtualHost>

Include "conf/extra/vhosts/*.conf"

2) Add a new directory named ( vhosts ) - C:\xampp\apache\conf\extra\vhosts\vhosts.conf
   In this new directory create a new file named vhosts.conf
   This is were you will be adding your new VHOSTS

Code:
#--------------------------------------------------------------
# CI 3.1.7 Dev Blog Testing - http://
#--------------------------------------------------------------
<VirtualHost *:80>
   DocumentRoot "\xampp\htdocs\ci3blog\public_html"
   ServerName ci3blog.localhost
   ServerAlias ci3blog.localhost
   <Directory "\xampp\htdocs\ci3blog\public_html">
       Order allow,deny
       Allow from all
       AllowOverride All
       Require all granted
   </Directory>
</VirtualHost>

#--------------------------------------------------------------
# CI 3.1.7 Dev Blog Testing https://
#--------------------------------------------------------------
<VirtualHost *:443>
    DocumentRoot "\xampp\htdocs\ci3blog\public_html"
   ServerName ci3blog.localhost
   ServerAlias ci3blog.localhost
   SSLEngine on
   SSLCertificateFile "conf/ssl.crt/server.crt"
   SSLCertificateKeyFile "conf/ssl.key/server.key"
   <Directory "\xampp\htdocs\ci3blog\public_html">
       Options All
        AllowOverride All
        Require all granted
   </Directory>
</VirtualHost>

#--------------------------------------------------------------

#--------------------------------------------------------------
# For New VHosts
#--------------------------------------------------------------

#--------------------------------------------------------------
#
#--------------------------------------------------------------

#--------------------------------------------------------------
# HTTP:
#--------------------------------------------------------------
#<VirtualHost *:80>
#    DocumentRoot "C:/xampp/htdocs/myproject/public_html"
#    ServerName myproject.localhost
#    ServerAlias myproject.localhost
#    <Directory "C:/xampp/htdocs/myproject/public_html">
#        Order allow,deny
#        Allow from all
#        AllowOverride All
#        Require all granted
#    </Directory>
#</VirtualHost>

#--------------------------------------------------------------
# HTTPS:
#--------------------------------------------------------------
#<VirtualHost *:443>
#    DocumentRoot "C:/xampp/htdocs/myproject/public_html"
#    ServerName myproject.localhost
#    ServerAlias myproject.localhost
#    SSLEngine on
#    SSLCertificateFile "conf/ssl.crt/server.crt"
#    SSLCertificateKeyFile "conf/ssl.key/server.key"
#    <Directory "C:/xampp/htdocs/myproject/public_html">
#        Options All
#        AllowOverride All
#        Require all granted
#    </Directory>
#</VirtualHost>

#--------------------------------------------------------------

See: The above ci3blog VHOSTS for an example also covers https://

To add a new vhosts to the windows host file just do this in the host file.

Code:
127.0.0.1    myproject.localhost