Skip to main content
The URL Tools suite provides two powerful features for managing links: a URL shortener for creating memorable short links and a redirect manager for SEO and site migration.

Permission Requirements

URL Tools require the access.admin.panel permission. All routes are protected by authentication, email verification, and permission middleware.

URL Tools Routes

Both tools are accessible from the admin panel:
// routes/web.php:76-80
// URL Shortener
Route::get('/url-shortener', [URLShortener::class, 'index'])->name('url.short');

// URL Redirect
Route::get('/url-redirect', [URLRedirect::class, 'index'])->name('url.redirect');

URL Shortener

Create short, memorable links for marketing campaigns and social media.

Accessing the URL Shortener

Navigate to /admin/url-shortener to manage short URLs.
// app/Http/Controllers/Admin/URLShortener.php:8-17
class URLShortener extends Controller
{
    /**
     * Display the URL shortener management page.
     */
    public function index()
    {
        return view('admin.url-short');
    }
}

URL Shortener Features

Create Short Links

Generate short URLs for long destination links

Custom Slugs

Create memorable custom short codes

Link Management

View and manage all your short links

Click Tracking

Track click analytics for each link
Short links are stored using the Link model:
// app/Models/Link.php:8-16
class Link extends Model
{
    protected $guarded = [];

    public function user()
    {
        return $this->belongsTo(User::class);
    }
}

Creating Short URLs

Use the URL Shortener Livewire component to create links.
1

Access URL Shortener

Navigate to /admin/url-shortener
2

Enter Destination URL

Provide the full URL you want to shorten
3

Choose Short Code

Auto-generate or create a custom slug
4

Save Link

Link is created and assigned to your user account
5

Copy Short URL

Use the generated short URL in your campaigns

Livewire URL Shortener Component

// app/Livewire/Admin/URLShortener.php:8-13
class URLShortener extends Component
{
    public function render()
    {
        return view('livewire.admin.u-r-l-shortener');
    }
}

Use Cases for URL Shortener

Share clean, short links on Twitter, Instagram, and other platforms with character limits.
Create trackable links for email marketing campaigns to measure engagement.
Generate QR codes from short URLs for offline-to-online marketing.

URL Redirects

Manage URL redirects for SEO, site migrations, and broken link fixes.

Accessing URL Redirects

Navigate to /admin/url-redirect to manage redirects.
// app/Http/Controllers/Admin/URLRedirect.php:8-17
class URLRedirect extends Controller
{
    /**
     * Display the URL redirect management page.
     */
    public function index()
    {
        return view('admin.url-redirect');
    }
}

URL Redirect Features

301 Redirects

Permanent redirects for moved content

302 Redirects

Temporary redirects for maintenance

Bulk Management

Manage multiple redirects efficiently

SEO Preservation

Maintain search engine rankings during migrations

Creating Redirects

1

Access Redirect Manager

Navigate to /admin/url-redirect
2

Enter Source URL

Provide the old URL path (e.g., /old-page)
3

Enter Destination URL

Specify where users should be redirected
4

Choose Redirect Type

Select 301 (permanent) or 302 (temporary)
5

Save Redirect

Redirect is activated immediately

Livewire URL Redirect Component

// app/Livewire/Admin/URLRedirect.php:8-13
class URLRedirect extends Component
{
    public function render()
    {
        return view('livewire.admin.u-r-l-redirect');
    }
}

Redirect Types

301 vs 302 Redirects
  • 301 Permanent: Use when content has permanently moved. Search engines transfer ranking signals to the new URL.
  • 302 Temporary: Use for temporary changes, A/B testing, or maintenance. Search engines keep ranking signals on the original URL.

Use Cases for URL Redirects

Redirect old URLs to new structure when redesigning your site:
  • /blog/2024/01/post-title/posts/post-title
  • /products/category/item/shop/item
  • Preserve SEO rankings and user bookmarks
Redirect old domain to new domain:
  • Set up domain-level redirects
  • Preserve all SEO value
  • Update DNS and hosting settings
  • Monitor redirect chains
Merge similar content:
  • Redirect duplicate pages to canonical version
  • Combine thin content into comprehensive pages
  • Eliminate keyword cannibalization
Create memorable campaign URLs:
  • /holiday-sale/products?campaign=holiday2024
  • /webinar/events/register/webinar-title
  • Easy to remember and share

URL Management Workflows

Short URL Workflow

1

Plan Your Links

Identify which long URLs need shortening for campaigns
2

Create Custom Slugs

Design memorable, brand-aligned short codes
3

Implement Tracking

Add UTM parameters to destination URLs for analytics
4

Test Links

Verify all short URLs redirect correctly before launch
5

Monitor Performance

Track click rates and engagement metrics

Redirect Management Workflow

1

Identify Broken Links

Review Google Search Console for 404 errors
2

Map Old to New URLs

Create a spreadsheet mapping old URLs to new destinations
3

Implement Redirects

Add redirects in the admin panel
4

Choose Redirect Type

Use 301 for permanent moves, 302 for temporary
5

Test Redirects

Verify each redirect works correctly
6

Monitor Crawl Errors

Check that 404 errors decrease in Search Console

Technical Implementation

Frontend Catch-All Route

Short URLs and redirects can use a catch-all route:
// routes/web.php:115-116 (commented out)
// Route::get('{link:slug}', RedirectToURL::class)->name('redirect');
The catch-all route is commented out by default to avoid conflicts with CMS dynamic pages. Enable it carefully based on your URL structure.
  1. Exact route matches (defined routes)
  2. Short URLs (if catch-all enabled)
  3. Redirects (if catch-all enabled)
  4. CMS dynamic pages
  5. 404 Not Found

Best Practices

Create effective short URLs:
  • Keep slugs short (5-15 characters)
  • Use lowercase letters and numbers
  • Make them memorable and relevant
  • Avoid confusing characters (0/O, 1/l)
  • Consider your brand in the slug
Avoid redirect chains:
  • Bad: A → B → C (multiple redirects)
  • Good: A → C (direct redirect)
  • Update old redirects when destinations change
  • Regularly audit redirect paths
Always test before going live:
  • Test in incognito/private browsing
  • Verify HTTP status codes (301/302)
  • Check mobile and desktop
  • Test with and without trailing slashes
  • Clear browser cache between tests
Document your URL strategy:
  • Maintain a spreadsheet of all short URLs
  • Document redirect mappings
  • Note the reason for each redirect
  • Track creation dates and campaign associations

Analytics Integration

Tracking Short URLs

Add UTM parameters to track campaign performance:
Destination URL: https://yoursite.com/product?utm_source=twitter&utm_medium=social&utm_campaign=summer_sale
Short URL: yoursite.com/summer

Google Analytics Setup

  1. Configure Goals in Google Analytics
  2. Create Custom Campaigns with UTM parameters
  3. Monitor Short URL click-through rates
  4. Track conversion funnels from short URLs
  • Short URL clicks
  • Redirect hits
  • 404 errors
  • Broken link reports

SEO Considerations

Important SEO Guidelines
  • Always use 301 redirects for permanently moved content
  • Avoid redirect chains (max 1-2 hops)
  • Update internal links instead of relying on redirects
  • Monitor Google Search Console for redirect issues
  • Keep redirect list maintainable (remove old, unused redirects)

301 Redirect Impact

  • Passes 90-99% of link equity
  • Tells search engines the move is permanent
  • Updates search results over time
  • Required for site migrations

302 Redirect Impact

  • Does not pass full link equity
  • Search engines keep indexing the original URL
  • Use for temporary changes only
  • Good for A/B testing

Troubleshooting

If redirects aren’t working:
  • Check the catch-all route is enabled
  • Verify no conflicting routes exist
  • Clear application cache: php artisan cache:clear
  • Check route priority in web.php
  • Test without browser cache
If you encounter redirect loops:
  • Check destination doesn’t redirect back to source
  • Review all redirects in the chain
  • Ensure no circular dependencies
  • Clear browser cache and cookies
  • Test in incognito mode
If short URLs conflict with pages:
  • Use a distinct prefix (e.g., /go/slug)
  • Move short URLs to subdomain (e.g., go.yoursite.com)
  • Carefully order routes in web.php
  • Document reserved slugs
If you used the wrong redirect type:
  • Update the redirect from 302 to 301 (or vice versa)
  • Clear CDN cache if applicable
  • Request re-crawl in Google Search Console
  • Monitor search rankings for changes

Advanced Features

Bulk Redirect Import

For site migrations, consider building bulk import:
// Example: Import redirects from CSV
// old_url,new_url,redirect_type
// /old-page,/new-page,301

Custom Short Domain

Use a custom domain for short URLs:
  1. Register a short domain (e.g., ysite.co)
  2. Point domain to your Laravel app
  3. Configure domain in settings
  4. Generate branded short links
Add expiration dates to short URLs:
  • Set expiration date on creation
  • Automatically disable expired links
  • Redirect to fallback page after expiration
  • Useful for time-sensitive campaigns

Security Considerations

Security Best Practices
  • Validate all destination URLs
  • Prevent open redirects to external sites
  • Implement rate limiting on short URLs
  • Monitor for abuse (spam, phishing)
  • Log all redirect access for auditing

Preventing Abuse

  • Require authentication for link creation
  • Implement CAPTCHA for public shorteners
  • Monitor unusual click patterns
  • Block malicious destination domains
  • Set usage quotas per user

Performance Optimization

Caching Strategies

  • Cache redirect mappings in Redis/Memcached
  • Use route caching for production
  • Implement CDN-level redirects for high traffic
  • Pre-load common redirects

Database Optimization

  • Index slug columns for fast lookups
  • Archive old, unused redirects
  • Paginate large redirect lists
  • Use database query caching

Multi-Tenant Considerations

As a SaaS platform:
  • Tenant Isolation: Each tenant has separate short URLs and redirects
  • Custom Domains: Support tenant-specific short domains
  • Usage Limits: Enforce per-tenant link quotas
  • Analytics: Provide tenant-level click analytics
  • Branding: Allow custom short URL prefixes per tenant

Next Steps

Dashboard Overview

Return to the admin dashboard

Blog Management

Learn about content management

Build docs developers (and LLMs) love