Download the PHP package jorisnoo/craft-locale-redirect without Composer

On this page you can find all versions of the php package jorisnoo/craft-locale-redirect. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package craft-locale-redirect

Craft Locale Redirect

A Craft CMS module that automatically redirects visitors from / to their locale-specific home route based on their browser language preferences.

Features

Requirements

Installation

Then register the module in your config/app.php:

How It Works

When a visitor hits your site's root URL (/), the module:

  1. Reads the Accept-Language header from the browser
  2. Fetches all configured Craft site locales and their URLs
  3. Finds the best match between browser preferences and available locales
  4. Issues a 302 redirect to the matched locale's home URL

If no match is found, the visitor is redirected to the primary site's locale prefix (or a configured fallback). Query parameters are preserved through the redirect.

Redirects always stay on the host the request came in on — only the locale path prefix is taken from the site base URLs. In a multi-domain setup, only locales served under the current site's host are considered as redirect targets; when the primary site lives on another host, the fallback uses the current site's prefix instead.

Configuration

The module works out of the box with no configuration. To customize behavior, create a config/locale-redirect.php file in your Craft project:

Exclude Sites

Prevent the redirect from triggering on specific sites (by handle). Useful when locale-specific sites already have their own prefix and shouldn't redirect further:

Exclude Locales

Prevent specific locales from being redirect targets:

Restrict to Specific Locales

Only allow redirection to specific locales. Takes precedence over exclude when both are set:

Fallback URL

The URL to redirect to when no browser locale matches. Defaults to the primary site URL:

Cross-Host Redirects

By default, redirects stay on the host the request came in on and only use the locale path prefixes from your site base URLs. If your locales live on separate domains instead (e.g. example.de and example.fr), enable cross-host redirects so the module targets the configured site base URLs verbatim, host included:

Note that with this enabled, requests arriving on an alias or staging domain are redirected to the sites' registered domains. When two sites share the same two-letter language on different hosts, a visitor already on one of those hosts stays there; otherwise the first-defined site wins.

Branching and Versioning

This package follows Semantic Versioning. Only Craft 5 is supported.

License

The MIT License (MIT). Please see LICENSE for more information.

Maintainer releases

See RELEASING.md for versioning, changelog entries and the release command.


All versions of craft-locale-redirect with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
craftcms/cms Version ^5.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package jorisnoo/craft-locale-redirect contains the following files

Loading the files please wait ...