Jump to content
The Uniform Server Community

Issue with relative urls


Zalaeth
 Share

Recommended Posts

Hi,

 

I've installed Uniform Server from scratch, however there is an issue.

 

I can't use links such as these => href="/favicon.ico"

 

It doesn't work, it doesn't add the file, I am forced to do something like this instead => href="../favicon.ico" depending on the number of folders that separate the two files.

 

I assume that's a setting, but I've never had to change that setting before, it always worked by default, and this problem is absolutely ungooglable.

 

Anyone knows how to fix it?

Link to comment
Share on other sites

Is there a way to delete this thread?

 

Any admin can delete a thread however you raised an issue and more importantly found a solution. This benefits other uses with the same or similar problem hence no reason to delete this thread.

 

All the best

Ric

Link to comment
Share on other sites

In this case I'll give a more detailed explanation.

 

My root directory was the following :

C:/UniServer/www

 

In this directory, I have different directories for different projects :

 

C:/UniServer/www/project1

C:/UniServer/www/project2

 

A link such as 'href="/favicon.ico"' will go look at the root of the Apache folder, which is typically www, in contrary to a PHP url which considers "/favicon.ico" to be in the folder where the first PHP page was called for the request.

 

Solution 1

 

Use the following href link = 'href="/project1/favicon.ico' instead of 'href="/favicon.ico"'

 

Solution 2

 

Find your httpd.conf file in your Apache directory, modify this line :

 

<Directory "C:/UniServer/www">

 

To this :

 

<Directory "C:/UniServer/www/project1/">

 

Then restart Apache

 

However, note that this means your other projects in the www folder will not be accessible anymore as they will be outside Apache.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...