Slugbit

Description

Slugbit is a lightweight, standalone WordPress plugin created to manage clean, memorable, trackable short redirect links on whatever domain WordPress runs on (e.g., https://example.com/wa or https://example.com/wa-group) without relying on external URL shorteners.

It operates completely independently of parent themes and active plugins, ensuring zero runtime coupling and full data preservation.

Key Features

  • Domain-Aware Short URLs: Derives short URLs dynamically from home_url('/' . $slug) so links automatically adapt across production, staging, and local domains.
  • Configurable Redirect Status Codes: Supports 302 Temporary (default), 301 Permanent, and 307 Temporary Preserve Method redirects.
  • Dedicated Custom Table: Stores links cleanly in {$wpdb->prefix}slugbit_links via dbDelta, tracking slug, target_url, status_code, is_active, clicks, last_clicked_at, notes, created_at, and updated_at.
  • Atomic Click Tracking: Increments clicks = clicks + 1 and updates last_clicked_at (UTC) atomically in SQL without race-condition lost counts.
  • Hostinger & LiteSpeed Cache Bypass: Emits nocache_headers() and X-LiteSpeed-Cache-Control: no-cache on every redirect response so edge/page caches never swallow clicks or stale targets.
  • WordPress Route & Security Safety: Intercepts only unmatched frontend 404 paths after WordPress query resolution; never breaks /wp-admin, /wp-json, wp-login.php, feeds, or existing posts, pages, custom post types, or taxonomies. Enforces reserved-slug checks and strict http/https target validation.
  • Unified WP Admin Directory: Manage links via a native WP_List_Table featuring 1-click Short URL copying, status badges, active toggles, search, status tabs, bulk actions, and nonce-protected Add/Edit forms.
  • Filter-Aware CSV Export: Stream the short links directory directly to CSV. Export respects active search terms, status tabs (“Active” / “Paused”), and HTTP redirect code filters.
  • Intelligent CSV Import with Conflict Strategy: Upload CSVs with auto-detected delimiters and auto-mapped column headers. Choose between safe “Skip Existing Slugs” (default) or “Update / Overwrite” (preserves historical clicks).
  • Unconditional Data Retention: Preserves all short links, click statistics, and options automatically on deactivation or deletion.

Import & Export Documentation

Exporting Links

The Export CSV button located on the directory table toolbar provides flexible exporting:
* Current Filter Respect: If you filter links by searching “promo” or selecting “Active” or HTTP 301, only matching links are exported. If no filters are active, your entire link catalog is exported.
* Compatibility: Exported CSV files include UTF-8 Byte Order Mark (BOM) ensuring flawless opening in Microsoft Excel, Apple Numbers, and Google Sheets.
* Columns Exported: id, slug, target_url, status_code, is_active, clicks, notes, created_at.

Importing Links

Click the Import button on the directory toolbar to open the slide-down import panel.
* Required Columns: slug and target_url.
* Optional Columns: status_code (defaults to 302), is_active (defaults to 1), notes, and clicks (defaults to 0 for new links).
* Sample Template: Download a ready-to-use CSV template directly from the import panel.
* Third-Party Migration: Automatically maps columns exported from Pretty Links (url), Redirection (source_url, action_data), Bitly (bitlink, long_url), and Simple 301 Redirects (request, destination).

Conflict Resolution Strategy Scenarios

When importing CSV files, Slugbit evaluates each row against your existing links:
* Scenario A (New Slug): The slug does not exist. It is created immediately and becomes active right away.
* Scenario B (Duplicate with “Skip Existing Slugs” – Default): The slug already exists. Slugbit skips the row. Existing live redirect rules, target URLs, and accumulated historical click counts are 100% preserved without any alteration.
* Scenario C (Duplicate with “Update / Overwrite Existing Slugs”): The slug already exists. Slugbit updates the destination URL, HTTP status code, and notes with the CSV values. Existing click totals and creation records are safely preserved.
* Scenario D (WordPress Route Conflict): The slug matches a core WordPress route (/wp-admin, /wp-json, login, feeds, or existing posts/pages). The row is automatically blocked to prevent breaking site functionality.
* Scenario E (Invalid Data / Scheme): Missing slug, missing destination, or dangerous URL schemes (javascript:, file paths) are rejected; only http:// and https:// URLs are accepted.

Screenshots

Installation

  1. Upload slugbit.zip via WP Admin Plugins Add New Plugin Upload Plugin, or clone/upload the slugbit folder to /wp-content/plugins/slugbit.
  2. Activate Slugbit through the Plugins menu in WordPress.
  3. The custom table {$wpdb->prefix}slugbit_links is provisioned automatically (starts empty with zero pre-seeded links).
  4. Open Slugbit in WordPress Admin to create, test, copy, and manage short redirect links.

FAQ

Does this plugin require any specific theme or plugin?

No. Slugbit is 100% standalone and works with any WordPress theme or plugin stack.

Will activating the plugin create default links automatically?

No. The links table starts empty so you have complete control over every active slug from day one.

Can a short link accidentally overwrite an existing WordPress page or `/wp-admin`?

No. Both write-time slug validation (reserved core paths, active CPTs, taxonomies, and existing posts/pages) and read-time routing (template_redirect only when is_404() and outside WP system endpoints) prevent shadowing WordPress content or admin routes.

What happens to my links and click counts if I deactivate or delete the plugin?

All short links, click totals, notes, and database tables are unconditionally preserved. Reinstalling later reconnects all existing links automatically.

Does Export respect my filters?

Yes. If you filter by search term, status tab (Active / Paused), or HTTP redirect code, only those filtered links are included in the CSV. If no filters are active, all links in your database are exported.

If I choose “Update / Overwrite Existing Slugs”, will I lose my accumulated click counts?

No. Updating an existing slug modifies its destination URL, HTTP status code, and notes, but strictly preserves its unique database ID, creation timestamp, and all accumulated click counts.

Can I import CSV files from Pretty Links or Redirection?

Yes. Slugbit automatically recognizes and maps common column headers from Pretty Links, Redirection, Bitly, and Simple 301 Redirects.

Reviews

There are no reviews for this plugin.

Contributors & Developers

“Slugbit” is open source software. The following people have contributed to this plugin.

Contributors

Translate “Slugbit” into your language.

Interested in development?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.

Changelog

0.0.4

  • Added filter-aware CSV Export streaming to the links directory toolbar.
  • Added CSV Import with automatic delimiter detection, sample template download, and competitor header auto-mapping.
  • Added Conflict Resolution Strategy with “Skip Existing Slugs” (default/safe) and “Update / Overwrite Existing Slugs” (preserves click counts).
  • Added custom brand logos for WordPress admin sidebar and dashboard header banner with automatic timestamp cache-busting.
  • Redesigned administrative user interface matching design system specifications with 6-color palette (Indigo, Teal, Ink, Mist, Amber, Red).
  • Improved “Create Short Link” form layout with equal-width, 2-per-row input grid.

0.0.1

  • Initial release of Slugbit.
  • Added dedicated {$wpdb->prefix}slugbit_links custom table via dbDelta with schema/index verification and non-destructive upgrade locks.
  • Added safe domain-aware template_redirect handler (is_404() guard, core/WP-route protection, strict http/https target validation, nocache_headers(), X-LiteSpeed-Cache-Control: no-cache, and atomic SQL click counting).
  • Added WP Admin Slugbit screen with summary KPI strip, Add/Edit form, WP_List_Table, 1-click Short URL copy, Active toggle, search, status views, and bulk actions.