diff --git a/app/Http/Controllers/Link/LinkController.php b/app/Http/Controllers/Link/LinkController.php index 2a63e98..ed1fb26 100644 --- a/app/Http/Controllers/Link/LinkController.php +++ b/app/Http/Controllers/Link/LinkController.php @@ -116,7 +116,11 @@ class LinkController extends Controller return back()->withInput()->withErrors(['destination_url' => $e->getMessage()]); } - return back()->with('success', 'Link updated.'); + $message = isset($validated['destination_url']) + ? 'Destination updated. Your short link is unchanged — new clicks go to the new URL.' + : 'Link updated.'; + + return back()->with('success', $message); } public function destroy(ShortLink $link): RedirectResponse diff --git a/app/Http/Controllers/Public/LinkRedirectController.php b/app/Http/Controllers/Public/LinkRedirectController.php index 96820d6..11c87bb 100644 --- a/app/Http/Controllers/Public/LinkRedirectController.php +++ b/app/Http/Controllers/Public/LinkRedirectController.php @@ -21,9 +21,16 @@ class LinkRedirectController extends Controller $link = $this->links->resolve($request, $slug); if ($link !== null && $link->isDirectRedirect()) { + // Always read the current destination from the DB so edits take effect + // immediately. 302 + no-store so browsers/CDNs do not pin an old Location. $target = $link->resolveRedirectUrl($request, $path); - return redirect()->away($target, 302); + return redirect() + ->away($target, 302) + ->withHeaders([ + 'Cache-Control' => 'no-store, no-cache, must-revalidate, max-age=0', + 'Pragma' => 'no-cache', + ]); } // Catalog / QR ecosystem slugs: proxy so destination stays live in the source app. diff --git a/resources/views/links/create.blade.php b/resources/views/links/create.blade.php index dd0660d..e6986b7 100644 --- a/resources/views/links/create.blade.php +++ b/resources/views/links/create.blade.php @@ -23,6 +23,7 @@ +
You can change this later. Your short link stays the same — only where it points updates.
@error('destination_url'){{ $message }}
@enderror diff --git a/resources/views/links/show.blade.php b/resources/views/links/show.blade.php index 56761d2..ee35a26 100644 --- a/resources/views/links/show.blade.php +++ b/resources/views/links/show.blade.php @@ -6,12 +6,21 @@+ Your short link never changes. Update the destination anytime — the next click goes to the new URL. +
@if ($link->is_managed_here) + @else +{{ $link->destination_url }}
{{ $link->destination_url }}
-