Skip to content

Commit 676e3e7

Browse files
committed
AltRedirect.vue - Added an instructions <h2> below the page title on management pages.
AltRedirectController.php - Supports instructions index.blade.php - Supports instructions README.md - Readme changes to document new query string features
1 parent 8e68beb commit 676e3e7

File tree

4 files changed

+55
-1
lines changed

4 files changed

+55
-1
lines changed

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- Supports headers on redirects
1010
- Regex Redirects
1111
- Imports and Exports
12+
- URI Query String Stripping
1213

1314
## How to Install
1415

@@ -56,6 +57,48 @@ php artisan vendor:publish --tag=alt-redirect-config
5657

5758
In the `headers` property, you can provide an array of headers to be passed to the `redirect` method.
5859

60+
### Query String Stripping
61+
62+
This is a new feature we've added to remove query strings from URIs before they're processed by the redirect middleware.
63+
64+
Because redirects are URI-based, an unexpected query string on a link would've cause your redirects to not function.
65+
66+
With this feature, you can strip out troublesome query strings so your redirects work as intended.
67+
68+
The Query Strings functionality can be found in the nav as a child underneath the Alt Redirect Addon
69+
```
70+
- Alt Redirect
71+
- Query Strings <---
72+
```
73+
74+
On this page you can manage the query strings you wish to strip, simply :
75+
- add the key of the query string `( eg 'foo' for ?foo=bar )`
76+
- Select your site
77+
- Hit save
78+
79+
You'll see your query string in the list.
80+
81+
#### Defaults
82+
83+
We've provided a few default query strings that will be stripped.
84+
They're added as regular items when you install the addon.
85+
86+
If you don't want / need these, simply delete them!
87+
88+
#### Artisan Command
89+
90+
We have provided an Artisan command to force the creation of defaults.
91+
92+
This will "force" create them, so they'll be installed even if the defaults have already been installed.
93+
94+
This is great for if you've deleted the defaults but want them back or if composer didn't install them during the addon install for some reason.
95+
96+
Simple run the command below and confirm when it asks you too :
97+
98+
```bash
99+
php artisan alt-redirect:default-query-strings
100+
```
101+
59102
## Questions etc
60103

61104
Drop us a big shout-out if you have any questions, comments, or concerns. We're always looking to improve our addons, so if you have any feature requests, we'd love to hear them.

resources/js/components/AltRedirect.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
export default ({
33
props: {
44
title: String,
5+
instructions: String,
56
action: String,
67
blueprint: Array,
78
meta: Array,
@@ -128,7 +129,10 @@ export default ({
128129
<template>
129130
<div id="alt-redirect">
130131

131-
<publish-form :title="title" :action="action" :blueprint="blueprint" :meta="meta" :values="values" @saved="updateItems($event)"></publish-form>
132+
<h1 class="flex-1">{{ title }}</h1>
133+
<h2 class="flex-1">{{ instructions }}</h2>
134+
135+
<publish-form :title="''" :action="action" :blueprint="blueprint" :meta="meta" :values="values" @saved="updateItems($event)"></publish-form>
132136

133137
<div class="card overflow-hidden p-0">
134138
<div class="mt-4 pb-2 px-4">

resources/views/index.blade.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<div id="alt-redirect-app" >
55
<alt-redirect
66
title="{{ $title }}"
7+
instructions="{{ $instructions }}"
78
action="{{ cp_route($action) }}"
89
:blueprint='@json($blueprint)'
910
:meta='@json($meta)'

src/Http/Controllers/AltRedirectController.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ class AltRedirectController
2020
'query-strings' => 'Alt Redirect - Query Strings'
2121
];
2222

23+
private array $instructions = [
24+
'redirects' => 'Manage your redirects here. For detailed instructions, please consult the Alt Redirect Readme',
25+
'query-strings' => 'Alt Redirect can strip query strings from your URIs before they are processed. These are listed below, add the key for query strings you want strip',
26+
];
27+
2328
// Work out what page we're handling
2429
public function __construct()
2530
{
@@ -61,6 +66,7 @@ public function index()
6166
'type' => $this->type,
6267
'action' => $this->actions[$this->type],
6368
'title' => $this->titles[$this->type],
69+
'instructions' => $this->instructions[$this->type],
6470
]);
6571
}
6672

0 commit comments

Comments
 (0)