Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

randm's avatar

Icons are not showing after creating virtual Host on Xampp for laravel

Hi, I have installed Platform 4.0 by Cartalyst. it was working okay on localhost/dev/public but would like to access it via app.dev

I created a virtual host by in these steps

I opened the httpd-vhosts.conf file located at F:\xamp\apache\conf\extra\https-vhosts.conf

and replaced everything with this

# 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 localhost>
    DocumentRoot "F:/xampp/htdocs"
    ServerName localhost
    ServerAdmin admin@localhost

    <Directory "F:/xampp/htdocs">
        Options Indexes FollowSymLinks
        AllowOverride FileInfo
        Order allow,deny
        Allow from all
    </Directory>

</VirtualHost>

# Development
<VirtualHost app.dev>

    DocumentRoot "F:/xampp/htdocs/dev/public"
    ServerName app.app
    ServerAdmin admin@localhost
    ServerAlias app.dev   

    <Directory "F:/xampp/htdocs/dev/public">
        AllowOverride All
        Order Allow,Deny
        Allow from all
        Require all granted
    </Directory>

</VirtualHost>

Then I opened my hosts file located at C:\Windows\System32\drivers\etc and added this line to it

127.0.0.1       localhost        app.dev

so my hosts file looks like this

127.0.0.1       localhost          app.dev
127.0.0.1       127.0.0.1

and now I am able to open my app.dev but the images do not resolve.

I updated the URL path in the app.php

'url' => 'http://app.dev',

How can I fix the images issue?

0 likes
8 replies
helmerdavila's avatar

Use in the image path (if its public path)

// asset not assett, this in intentionally for scape.
<img src ="{{ assett (  'route_your_image.png'  )" }}
randm's avatar

@helmerdavila I am not sure why would I need to use that is the problem is with the Virtual Host? it was working with no problems until I added the virtual host

helmerdavila's avatar

@malhayek Yea, but the static files error its for the virtualhost, and you call not for a route /img/etc, use the asset helper and test.

randm's avatar
randm
OP
Best Answer
Level 6

I was advised to remove all the files in side public\cache\assets folder except of .gitignore and it worked :)

abdullzz's avatar

public\cache\assets i can't find cache folder inside my laravel project. where is that?

sureshramani's avatar

If you are using apache as a web server then use this method to solve this.

Comment Alias in /etc/apache2/mods-available/alias.conf.

<IfModule alias_module>
	# Aliases: Add here as many aliases as you need (with no limit). The format is
	# Alias fakename realname
	#
	# Note that if you include a trailing / on fakename then the server will
	# require it to be present in the URL.  So "/icons" isn't aliased in this
	# example, only "/icons/".  If the fakename is slash-terminated, then the
	# realname must also be slash terminated, and if the fakename omits the
	# trailing slash, the realname must also omit it.
	#
	# We include the /icons/ alias for FancyIndexed directory listings.  If
	# you do not use FancyIndexing, you may comment this out.

#	Alias /icons/ "/usr/share/apache2/icons/"

#	<Directory "/usr/share/apache2/icons">
#		Options FollowSymlinks
#		AllowOverride None
#		Require all granted
#	</Directory>

</IfModule>

After Comment these lines check apache conf using this command:

sudo apache2ctl -t

Then reload apache2:

sudo systemctl reload apache2

Please or to participate in this conversation.