简体   繁体   中英

Laravel 5.1 Disturbance with Virtual Host on Local Server

I've just installed Laravel 5.1 and I've created a Virtual host for it 'www.laravelproperty.com' whose root directory is 'larvel-property/public/index.php'.

<VirtualHost *:80>
   ServerAdmin m.khuramj@live.com
   ServerName laravelproperty.com
   ServerAlias www.laravelproperty.com

   DocumentRoot /var/www/property-project/public/index.php

   ErrorLog ${APACHE_LOG_DIR}/error.log
   CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

I've also changed the 'application URL' in config/app.php (but that affects artisan cli). I've included HTML and Form classes. When I try to include css using the following syntax in my master template head:

{!!HTML::style('css/boostrap.min.css') !!}

it links the file but nothing is implemented. While in firebug it shows file 'bootstrap.min.css' with 0 rules and it's url is shown as 'www.laravelproperty.com/css/bootstrap.min.scs'. But when I include it from the Internet 'bootstrap' with the following syntax:

{!!Html::style('//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css')!!}

it works, it means there is a pathe problem, but I'm unable to fix it. Can some one help me in this regard? What is the thing I'm unable to fix?

What you could do is the following:

{!!HTML::style(URL::asset('css/bootstrap.min.css') !!}

or

{!!HTML::style(asset('css/bootstrap.min.css') !!}

This will essentially create the correct URL to your asset (your css file in this case) and will put it in a html-style tag.

I've solve the problem. Thanks for the answer LeShadow. The problem was that I was using 'index.php' file in my root directory like this:

DocumentRoot /var/www/property-project/public/index.php

Just remove '/index.php' from the above line (which is the part of my virtual host file) and will become:

DocumentRoot /var/www/property-project/public

Well, this has solved my problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM