Description
Links such as /, /about-us/ or /contact/ are handy because they work on any domain. But when WordPress lives in a subfolder — for example https://example.com/demo/ — those links jump to the domain root and visitors land on the wrong page or a 404.
Subfolder Link Fixer detects your site’s subfolder from the Home URL and quietly fixes those links in the page sent to the browser:
href="/"becomeshref="/demo/"href="/about-us/"becomeshref="/demo/about-us/"- Form actions like
action="/contact/"are fixed too.
Nothing is written to your content. Your posts, menus and page-builder data stay exactly as they were, so you can move the site back to a root domain, export it, or switch the plugin off at any time.
Features
- Automatic subfolder detection from the Home URL — nothing to configure.
- Choose what to fix: links (
href), form actions (action), images and scripts (src) and responsive images (srcset). - Excluded paths: keep links that should really leave the site, such as
/shop/on the same domain, untouched. - Manual subfolder for sites served from a folder by a reverse proxy.
- Live link tester on the settings screen shows exactly what visitors get.
- Automatic page-cache clearing when settings change, for LiteSpeed Cache, WP Rocket, W3 Total Cache, WP Super Cache and SiteGround Optimizer.
- Debug comment for administrators with the number of links fixed on a page.
- Site Health section under Tools Site Health Info.
- WP-CLI:
wp subfolder-links statusandwp subfolder-links test / /about-us/.
Good for
- Theme and template-kit demo sites hosted side by side, e.g.
example.com/kit-one/,example.com/kit-two/. - Staging copies that live in a subfolder of the live domain.
- Subdirectory Multisite networks — every subsite gets its own folder automatically.
- Imported content or page-builder layouts that contain hard-coded
/links.
What it leaves alone
- Protocol-relative links (
//cdn.example.com/...) and full URLs. - Links that already include the subfolder, and paths you exclude.
data-*attributes.- Admin screens, AJAX, REST API, feeds and the Elementor editor preview.
- Sites installed at the domain root — the plugin simply stays idle.
For developers
vantorix_slf_attributes— array of attributes to rewrite.vantorix_slf_excluded_paths— array of path prefixes to skip.vantorix_slf_should_run— returnfalseto skip the current request.vantorix_slf_purge_caches— action fired after settings change; purge your own cache here.
Example: skip rewriting on one page.
add_filter( 'vantorix_slf_should_run', function ( $run ) {
return is_page( 'landing' ) ? false : $run;
} );
Screenshots


Installation
- Go to Plugins Add New, search for “Subfolder Link Fixer”, then install and activate. Or upload the zip from Plugins Add New Upload Plugin.
- Open Settings Subfolder Link Fixer, check the detected subfolder and try a link in the tester.
- Done. If your cache plugin is one of the supported ones, it is cleared for you when you save.
FAQ
-
Does it change my database or page-builder data?
-
No. Links are rewritten only in the HTML sent to visitors. The plugin stores only its own settings. Deactivate it and everything is exactly as before.
-
My site is at the domain root. Do I need this?
-
No. When there is no subfolder in your Home URL the plugin does nothing.
-
Some links should go to the domain root on purpose.
-
Add their path to Excluded paths under Advanced, one per line, e.g.
/shop/. Links starting with that path are left alone. -
Should I enable src and srcset?
-
Only if your content has images or scripts with paths like
/wp-content/...that break in the subfolder. Links and form actions are enabled by default. -
Does it work with Elementor and other page builders?
-
Yes. It works on the final HTML, so it does not matter which builder or theme produced the link. The Elementor editor preview is skipped so editing is not affected.
-
Does it work with caching plugins?
-
Yes. Pages are cached after the links are fixed. LiteSpeed Cache, WP Rocket, W3 Total Cache, WP Super Cache and SiteGround Optimizer are cleared automatically when you change settings. For other caches, clear them once yourself.
-
How can I check it is working?
-
Use the tester on the settings screen, turn on the debug comment and view the page source, or run
wp subfolder-links test /about-us/. -
Will it slow down my site?
-
The work is a single pattern replacement on the page output, which is very fast. With a page cache it runs only when a page is generated.
-
Does it work on Multisite?
-
Yes, on subdirectory networks. Each subsite uses its own folder from its own Home URL. It can be network-activated.
Reviews
ഈ പ്ലഗിന് റിവ്യൂകൾ ഒന്നുമില്ല.
Contributors & Developers
“Vantorix – Subfolder Link Fixer” is open source software. The following people have contributed to this plugin.
ContributorsTranslate “Vantorix – Subfolder Link Fixer” into your language.
Interested in development?
Browse the code, check out the SVN repository, or subscribe to the development log by RSS.
Changelog
1.1.0
- New: choose which attributes to fix — href, action, src and srcset (responsive images).
- New: excluded paths.
- New: manual subfolder for reverse-proxy setups.
- New: page cache is cleared automatically when settings change (LiteSpeed Cache, WP Rocket, W3 Total Cache, WP Super Cache, SiteGround Optimizer).
- New: debug comment for administrators showing how many links were fixed.
- New: Site Health info section.
- New: WP-CLI commands
wp subfolder-links statusandwp subfolder-links test. - Improved: link tester now follows excluded paths and the manual subfolder.
- Changed: plugin name now uses a plain hyphen, matching other Vantorix plugins.
1.0.0
- Initial release.
