PHPackages                             elgentos/module-baseurlpath - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. elgentos/module-baseurlpath

ActiveMagento2-module[Utility &amp; Helpers](/categories/utility)

elgentos/module-baseurlpath
===========================

Allow Magento config to have a base url path instead of root without moving Magento 2 into a subdirectory

1.0.1(5y ago)104.9k2GPL-3.0PHP

Since Oct 1Pushed 5y ago2 watchersCompare

[ Source](https://github.com/elgentos/magento2-baseurlpath)[ Packagist](https://packagist.org/packages/elgentos/module-baseurlpath)[ RSS](/packages/elgentos-module-baseurlpath/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (2)Dependencies (3)Versions (3)Used By (0)

[![Build Status](https://camo.githubusercontent.com/db639ceaa6782e8378ca57653b4826ff365908469d0f94a7989e8292ad55cecc/68747470733a2f2f7472617669732d63692e6f72672f656c67656e746f732f6d6167656e746f322d6261736575726c706174682e7376673f6272616e63683d6d61696e)](https://travis-ci.org/elgentos/magento2-baseurlpath)

Magento 2 - Elgentos\_BaseUrlPath
=================================

[](#magento-2---elgentos_baseurlpath)

Allow setting up a base url in system config other than root.

If you want to add `https://my.domain.tld/mypseronalurl/` after the baseurl Magento currently doesn't allow this. You are left with adding the storecode to the path or creating subdirectories with extra files.

This can get ugly if you just want to add language codes(other than locale-codes) to your domain, for example `https://my.domain.tld/en/` and `https://my.domain.tld/nl/`

Installation: part 1 - Module via composer
------------------------------------------

[](#installation-part-1---module-via-composer)

Install the module via composer by running

```
composer require elgentos/module-baseurlpath

bin/magento module:enable Elgentos_BaseUrlPath
bin/magento cache:flush
```

Installation: part 2 - Nginx MAGE\_RUN\_CODE
--------------------------------------------

[](#installation-part-2---nginx-mage_run_code)

Make sure you setup your `MAGE_RUN_CODE` mapping correctly. By default in Nginx this is only done based on **$host** name.

We will add the **$request\_uri** to the mapping.

```
# https://{host}/{language}/{magento_request}/
# Most specific match goes first
map $host$request_uri $mageRunCode {
  hostnames;
  default default;
  ~other.domain.tld/nl/ other_nl;
  ~other.domain.tld other_en;
  ~my.domain.tld/en/ site_en;
  ~my.domain.tld site_nl;
}

# fastcgi section
fastcgi_param MAGE_RUN_CODE $mageRunCode;
```

### Nginx without mapping

[](#nginx-without-mapping)

Or if Nginx mapping isn't available for you.

```
# https://{host}/{language}/{magento_request}/
# Most specific match goes last
# this one is untested thought(sorry for that)

set $mageRunCode "default";
if ($host$request_uri ~ other.domain.tld/) {
    set $mageRunCode "other_en";
}
if ($host$request_uri ~ other.domain.tld/nl/) {
    set $mageRunCode "other_nl";
}
if ($host$request_uri ~ my.domain.tld/) {
    set $mageRunCode "site_nl";
}
if ($host$request_uri ~ my.domain.tld/en/) {
    set $mageRunCode "site_en";
}
```

Configuration
-------------

[](#configuration)

After installation goto `Stores` / `Configuration` -&gt; `General` / `Web` -&gt; `Base URLs ((Un)Secure)`

**My strong advise setting these settings on website or store view level because making errors could potentially lock you out from the admin pages**

Store 1: site\_en
-----------------

[](#store-1-site_en)

Update your base url to `https://my.domain.tld/en/`[![example baseurl setting english store](example-baseurl-en.png)](example-baseurl-en.png)

Store 2: site\_nl
-----------------

[](#store-2-site_nl)

Update your base url to `https://my.domain.tld/nl/`[![example baseurl setting dutch store](example-baseurl-nl.png)](example-baseurl-nl.png)

Static content and media
------------------------

[](#static-content-and-media)

To make static content work with these settings, you explicitly need to setup these paths to the root(`/`) of your site.

[![example baseurl setting static media parameters](example-baseurl-static-media.png)](example-baseurl-static-media.png)

Authors
-------

[](#authors)

- [Jeroen Boersma](https://github.com/jeroenboersma)
- [Wouter Steenmeijer](https://github.com/woutersteen)
- [Peter Jaap Blaakmeer](https://github.com/peterjaap)

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

2

Last Release

2053d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/88a6d8dc588e8f2a0948335563a754687f71304f0bd3b7f7049d4bcdc00a563c?d=identicon)[peterjaap](/maintainers/peterjaap)

---

Top Contributors

[![JeroenBoersma](https://avatars.githubusercontent.com/u/1163348?v=4)](https://github.com/JeroenBoersma "JeroenBoersma (15 commits)")

---

Tags

magento2magento2-module

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/elgentos-module-baseurlpath/health.svg)

```
[![Health](https://phpackages.com/badges/elgentos-module-baseurlpath/health.svg)](https://phpackages.com/packages/elgentos-module-baseurlpath)
```

###  Alternatives

[baldwin/magento2-module-url-data-integrity-checker

Magento 2 module which can find potential url related problems in your catalog data

281773.3k](/packages/baldwin-magento2-module-url-data-integrity-checker)[yireo/magento2-webp2

Magento 2 module to add WebP support to the Magento frontend

2091.2M7](/packages/yireo-magento2-webp2)[smile/module-store-delivery

Smile Store Delivery

23348.7k1](/packages/smile-module-store-delivery)[mage-os/module-theme-optimization

Page transitions and speculative loading rules for Magento

418.0k](/packages/mage-os-module-theme-optimization)[graycore/magento2-graphql-introspection-cache

1015.2k](/packages/graycore-magento2-graphql-introspection-cache)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
