Support the ongoing development of Laravel.io →
Configuration
Last updated 1 year ago.
0

My guess is that you have used relative url in your links to stylesheets and javascript files with a leading / in them. I assume that's what you mean by linked files. You can solve this in one of two ways. 1). Change the link to your files by using an absolute url meaining you would have something like

<link href="http://localhost/comm-app/public/css/style.css";>

2). Set a base href tag at the top of your head element of your template/view file. Use the elemet <base> also you to prepend all relative urls with the url in the href attribute. Example:

<html>
<head>
<base href="http://localhost/comm-app/public/"; />

Using option two will allow you to migrate your application in case you moved it to another domain. This can also have a slight performance enhancement, as the assets will not need to perfrom a DNS lookup for each file you are trying to link to.

Last updated 1 year ago.
0

Thank you. I believe that you are correct but a better solution for me was setting up a virtual host through the Apache configuration file. I am using MAMP so it is pretty easy when you know what to do. This article provided the best instructions:

http://sawmac.com/mamp/virtual/

I apologize that I don't more about server configuration. I just followed the instructions from Laravel documentation that said to run Laravel just issue php artisan serve. That is the way I built the entire app. I used Pagodabox as my public testing server.

I was just curious how to run my app from my development server's Apache. Setting up a virtual server is exactly what I wanted. I was incorrect about the .htaccess file. It was set up correctly out of the box. By using the virtual server all of the relative links are then correct.

I also think I may have learned something about the file structure of Laravel. The directories above public are above the public directory in order to secure the files in those directories.

Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.