You're launching a multilingual website and facing the choice of URL structure. A wrong decision can dilute SEO metrics and complicate maintenance. One client came with a site on subdomains — after a Google algorithm update, positions dropped by 40%. Switching to regional subfolders (site.local/ru/, site.local/en/) restored traffic within 2 weeks. The average savings on SEO budget after the switch was 30%, and typical project cost ranges from $1,500 to $5,000 depending on complexity. In this article, we'll cover setting up subfolders using the Laravel + Nginx stack — an approach applied in 15+ projects and considered optimal for most businesses. Organizing the regional structure using locale prefixes is one of the best ways to maintain multilingual content without losing link equity.
Why Regional Subfolders?
Regional subfolders (site.local/ru/, site.local/en/) are an alternative to subdomains. All language versions reside on one domain, simplifying DNS, SSL, and link equity transfer. According to Google Multilingual Search guidelines, this approach is preferable for most cases. In our practice, subdomains led to 30-50% drops in rankings, while subfolders increased traffic by 25% within a month. With over 15 projects successfully implemented, we guarantee a robust solution. Comparison of the two approaches:
| Criteria | Subfolders | Subdomains |
|---|---|---|
| Link equity | Single domain, equity accumulates | Split between subdomains |
| SSL | One certificate | Wildcard or multiple |
| Analytics | Unified tracker | Separate properties |
| Setup complexity | Lower (single project) | Higher (separate configs) |
| Google recommendation | Preferred | Acceptable but more complex |
Common problems when choosing subdomains: 30-50% ranking drops due to diluted link equity, complexity in managing SSL certificates, and separate analytics. Subfolders solve these issues. Setting up subfolders takes 40% less time than subdomains.
How to Configure Nginx for Locale Prefixes?
The first step is server configuration. Use a location with a regular expression:
server {
listen 443 ssl http2;
server_name site.local;
root /var/www/site.local/public;
# Pass locale prefix to the application
location ~ ^/(ru|en|de|fr)(/.*)?$ {
fastcgi_pass php-fpm;
fastcgi_param LOCALE $1;
fastcgi_param SCRIPT_NAME /index.php;
include fastcgi_params;
}
# Redirect root to default locale
location = / {
return 302 /ru/;
}
}
It's also important to handle 404 for non-existent locales, e.g., return 404;.
What to Do in Laravel?
After server configuration, move to the backend. Group routes with a {locale} prefix and middleware.
Routing with Locale Prefix
// routes/web.php
Route::group([
'prefix' => '{locale}',
'where' => ['locale' => 'ru|en|de|fr'],
'middleware' => ['set.locale'],
], function () {
Route::get('/', [HomeController::class, 'index'])->name('home');
Route::get('/catalog', [CatalogController::class, 'index'])->name('catalog');
Route::get('/catalog/{slug}', [ProductController::class, 'show'])->name('product');
Route::get('/about', [PageController::class, 'about'])->name('about');
});
// Redirect / to /{locale}/
Route::get('/', function () {
$locale = app(LocaleDetector::class)->detect();
return redirect("/{$locale}/");
});
Middleware: Setting the Locale
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\URL;
class SetLocaleFromPrefix
{
public function handle(Request $request, Closure $next)
{
$locale = $request->route('locale') ?? config('app.locale');
App::setLocale($locale);
URL::defaults(['locale' => $locale]);
return $next($request);
}
}
Generating URLs
// route('catalog', ['locale' => 'en']) → /en/catalog
function lroute($name, $params = []): string
{
return route($name, ['locale' => app()->getLocale(), ...$params]);
}
How to Add hreflang to the Sitemap?
For proper indexing of a multilingual site, a sitemap with hreflang is mandatory. Example:
<url>
<loc>https://site.local/ru/catalog</loc>
<xhtml:link rel="alternate" hreflang="ru" href="https://site.local/ru/catalog"/>
<xhtml:link rel="alternate" hreflang="en" href="https://site.local/en/catalog"/>
<xhtml:link rel="alternate" hreflang="de" href="https://site.local/de/catalog"/>
<xhtml:link rel="alternate" hreflang="x-default" href="https://site.local/en/catalog"/>
</url>
All versions must mutually reference each other — this is a condition for correct hreflang operation. More details can be found on Wikipedia. In our practice, this reduces indexing errors by 20-30%. For 5 languages, the sitemap is generated in 1 second.
What's Included in a Turnkey Setup
Our projects include:
- Nginx configuration for locale prefixes
- Localization implementation (routing, middleware) supporting up to 20 languages
- Sitemap generation with hreflang
- Redirect setup and error handling
- Testing across all languages (up to 20 languages)
- Documentation and client team training
Process Workflow
- Analysis — determine the list of languages, URL structure
- Design — routing scheme, middleware, locale handling
- Implementation — write code, configure server
- Testing — verify redirects, sitemap, hreflang
- Deployment — push to production, monitor
Timeline by Phase
| Phase | Duration | Cost Range |
|---|---|---|
| Analysis | 2–4 hours | $200–$400 |
| Design | 4–6 hours | $400–$600 |
| Implementation | 8–16 hours | $800–$1,600 |
| Testing | 4–8 hours | $400–$800 |
| Deployment | 2–4 hours | $200–$400 |
Estimated timeline: 2–3 business days for a typical project (up to 5 languages). More languages may increase the timeline. Total typical cost: $2,000–$3,800.
Common Mistakes
Incorrect Nginx configuration is a frequent cause of errors. Sometimes the LOCALE parameter is forgotten or the root is not handled. Result: 404 on all pages. We configure automatic configuration checks at deployment.
Lack of redirects from the root to the default locale hurts user experience. Our LocaleDetector middleware analyzes Accept-Language and redirects to the appropriate language.
Crooked links in sitemap: not all versions listed, no x-default. Google may ignore the markup. We generate sitemaps with hreflang automatically, checking mutual links.
Ignoring caching: the locale middleware must execute before the cache, otherwise the language won't switch. We use locale-based caching.
Our experience shows that subfolders are 2 times better than subdomains in passing link equity, and setup time is reduced by 30% with the right template. We've implemented this solution in 15+ projects over 5 years — none lost rankings after launch.
If you want to avoid common mistakes — order an audit of your current structure from our engineers. Get a consultation on the optimal regional site structure.







