Support the ongoing development of Laravel.io →
Requests Database Views
Last updated 1 year ago.
0

Are you talking about the TLD changing or using a dot instead of a forward slash?

0

Using a dot instead of a slash.

So for example my url would look like this

www.mypage.com

but for the french it would look like this

www.mypage.fr
0

I made some changes to my code.

For my routes.php

Route::group(['suffix' => '{$tld}', 'before' => 'localization'], function() {
    Route::get('/', function() {
        return View::make('localization_test');
    });
});

For my filters.php

Route::filter('localization', function() {
	$tld = get_tld();
    App::setLocale($tld);
});

I also created a helpers.php

if ( ! function_exists('get_tld'))
{
    function get_tld()
    {
        $matches = array();
        preg_match('/laravel-local(.[a-zA-Z]+)/', Request::root(), $matches);
        $tld = $matches[1];

        return $tld;
    }
}

This picks up the .com, but when I try to change the .com into a .fr I get this error

Not Found

The requested URL /laravel-local.fr/public/ was not found on this server.
0

I'm sorry if this annoys anyone, but I'm a bit desperate at the moment. Can someone please help

0

I'm sorry if this annoys anyone, but I'm a bit desperate at the moment. Can someone please help

0

Can someone please help

0

Have you got all the registered domains setup? A TLD means it is a different website.

0

At the moment I'm using my localhost. I've made it into a virtual host server

0

You can do it on your local as long as you set up all the entries in your hosts file. It will not fly on a server unless you register all those domains.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

shiva shiva Joined 24 Jul 2014

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.