Laraval and XAMP combination problems when redirecting to home page

So I finished creating an intranet site in Laravel 5 for my company.
Now I need to move this site from my development machine to our server (not that hard) but I also needed to change some of the filepaths so the url’s wouldn’t be flooded with mapnames.

I had a file structure

c:/xampp/htdocs/intranet/laravel/…

Now, I changed the directory structure so it would remove the laravel from the urls so now my file structure is

c:/Xampp/htdocs/intranet/…

so all the laravel related files and folders are now under intranet, I now have an issue however if I surf to

localhost/intranet/public

it will redirect to this URL:

localhost/C:/xampp/htdocs/intranet/public/public.

I was messing around a bit with the .htaccess file and the index.php files so I might have broken something, does anyone know what I might have done wrong? (also if you know how to remove the public from the url’s it would be a nice addition)

.htaccess :

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes...
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

index.php:

<?php
/**
 * Laravel - A PHP Framework For Web Artisans
 *
 * @package  Laravel
 * @author   Taylor Otwell <taylorotwell@gmail.com>
 */

/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader for
| our application. We just need to utilize it! We'll simply require it
| into the script here so that we don't have to worry about manual
| loading any of our classes later on. It feels nice to relax.
|
*/

require __DIR__.'/../bootstrap/autoload.php';

/*
|--------------------------------------------------------------------------
| Turn On The Lights
|--------------------------------------------------------------------------
|
| We need to illuminate PHP development, so let us turn on the lights.
| This bootstraps the framework and gets it ready for use, then it
| will load up this application so that we can run it and send
| the responses back to the browser and delight our users.
|
*/

$app = require_once __DIR__.'/../bootstrap/app.php';

/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can simply call the run method,
| which will execute the request and send the response back to
| the client's browser allowing them to enjoy the creative
| and wonderful application we have prepared for them.
|
*/

$kernel = $app->make('IlluminateContractsHttpKernel');

$response = $kernel->handle(
    $request = IlluminateHttpRequest::capture()
);

$response->send();

$kernel->terminate($request, $response);


Source: .htaccess

Leave a Reply