first post on stackoverflow!
Been at this for hours and can't figure it out.
Wamp is installed to C:\wamp, website is in C:\wamp\www\groovysite.net and displays in my browser at localhost/groovysite.net.
There is a subfolder groovysite.net/subfolder. The problem is that all relative urls in pages contained in the subfolder are adding the subfolder into the url path just after the root folder.
For example two stylesheets live in
C:/wamp/www/groovysite.net/stylesheets/app.css
C:/wamp/www/groovysite.net/style.css
In my site's head is
<link rel="stylesheet" href="stylesheets/app.css" />
<link rel="stylesheet" href="style.css">
On the hompepage groovysite.net/index.html the url paths are
localhost/groovysite.net/stylesheets/app.css
localhost/groovysite.net/style.css
so they work. But on subfolder/page.html the paths are
localhost/groovysite.net/subfolder/stylesheets/app.css
localhost/groovysite.net/subfolder/style.css
so it seems like WAMP is sticking the subfolder path onto the relative urls.
I read that setting up virtual hosts directs WAMP to find the correct document root for each virtual host and that would sort this issue out. To that end this is my current configuration on apache 2.4.9:
Hosts file:
127.0.0.1 localhost
::1 localhost
127.0.0.1 groovysite.net
::1 groovysite.net
httpd.conf virtual hosts line is uncommented
httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot "c:/wamp/www"
ServerName localhost
ServerAlias localhost
ErrorLog "logs/localhost-error.log"
CustomLog "logs/localhost-access.log" common
<Directory "c:/wamp/www">
AllowOverride All
Options Indexes FollowSymLinks
Require local
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "c:\wamp\www\groovysite.net"
ServerName groovysite.net
ServerAlias www.groovysite.net
ErrorLog "logs/groovysite.net-error.log"
CustomLog "logs/groovysite.net-access.log" common
<Directory "c:/wamp/www/groovysite.net">
AllowOverride All
Options Indexes FollowSymLinks
Require local
</Directory>
</VirtualHost>
Code was taken from RiggsFolly's answer here.
Completely stumped...any help would be greatly appreciated!