PHPackages                             alt-design/alt-redirect - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. alt-design/alt-redirect

ActiveLibrary

alt-design/alt-redirect
=======================

Alt Redirect addon, add Redirects to your site

v1.7.0(3mo ago)1139.4k↓10.4%12[5 issues](https://github.com/alt-design/Alt-Redirect-Addon/issues)[4 PRs](https://github.com/alt-design/Alt-Redirect-Addon/pulls)MITPHPPHP ^8.1

Since Nov 3Pushed 3mo ago2 watchersCompare

[ Source](https://github.com/alt-design/Alt-Redirect-Addon)[ Packagist](https://packagist.org/packages/alt-design/alt-redirect)[ RSS](/packages/alt-design-alt-redirect/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (1)Versions (42)Used By (0)Security (1)

Alt Redirect
============

[](#alt-redirect)

> Ez pz redirects, simple, spicy and nicey.

Features
--------

[](#features)

- Redirects to and from
- Set the status of redirects
- Supports headers on redirects
- Regex Redirects
- Imports and Exports
- URI Query String Stripping

How to Install
--------------

[](#how-to-install)

You can search for this addon in the `Tools > Addons` section of the Statamic control panel and click **install**, or run the following command from your project root:

```
composer require alt-design/alt-redirect
```

Basic usage
-----------

[](#basic-usage)

### Simple redirects

[](#simple-redirects)

Just take a request to one URL and redirect to a new url, for example

From :

```
/old-page

```

To :

```
/new-page

```

### Regex redirects

[](#regex-redirects)

These, other hand, allow much richer redirect functionality.
Lets say you changed a wildcard URL path to be a query parameter on a new page, this can done like so

From :

```
/old-page/(.*)

```

To :

```
/new-page?wildcard=$1

```

the '$x' (where x is a number) elements are arranged in the order the corresponding '(.\*)' appeared in the 'From' URL, this allows rearranging the regexed fields in the 'To' URL.

### Headers on redirect

[](#headers-on-redirect)

You can add headers to the redirect response using the addon's config file. To get started, publish the config file to your site:

```
php artisan vendor:publish --tag=alt-redirect-config
```

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

### Query String Stripping

[](#query-string-stripping)

This is a new feature we've added to remove query strings from URIs before they're processed by the redirect middleware.

Because redirects are URI-based, an unexpected query string on a link would've cause your redirects to not function.

With this feature, you can strip out troublesome query strings before your redirects are processed.

Following this, you can choose to either add the query string back to the redirect URL, or strip it out entirely. The default behaviour for this is to add the filtered query strings back after the redirect has been found.

You can set a query string to be stripped using the "strip" toggle in the Query Strings admin panel.

The Query Strings functionality can be found in the nav as a child underneath the Alt Redirect Addon

```
- Alt Redirect
    - Query Strings
