iqnection/silverstripe-redirects

Provides interface for setting up redirects

Installs: 13

Dependents: 1

Suggesters: 0

Security: 0

Stars: 0

Watchers: 3

Forks: 0

Open Issues: 0

Type:silverstripe-vendormodule

1.0.1 2021-04-06 20:47 UTC

This package is auto-updated.

Last update: 2022-05-06 23:28:28 UTC


README

Provides an interface to setup redirects from old URLs to new pages Resolves alternate domains if you're meging sites together Great for setting up 301 redirects when launching a new site with URL changes

Installation

$ composer require iqnection/silverstripe-redirects

Run a database rebuild and flush https://example.com/dev/build?flush=1

It's strongly suggested to set the environment variable for your main site URL In your root .env file and add/update the following

SS_BASE_URL="https://www.your-domain.com"

Usage

Navigate to Redirects area in the CMS to manage your redirects

Domains will automatically be matched regardless of if "www" is included, or if HTTP or HTTPS.

Examples:

Redirect from example.com to somewhere Request URLs:

  • example.com => redirect match
  • www.example.com => redirect match
  • subdomain.example.com => no match
  • www.subdomain.example.com => no match

Redirect from subdomain anything.example.com to somewhere (assuming anything.example.com and example.com resolve to different hosting accounts) Request URLs:

  • example.com => redirect match
  • www.example.com => no match
  • subdomain.example.com => match
  • www.subdomain.example.com => redirect match

Redirect from alternate domain another-example.com to somewhere on example.com (assuming another-example.com and example.com resolve to the same hosting account) Request URLs:

  • example.com => redirect match
  • www.example.com => redirect match
  • another-example.com => redirect match
  • www.another-example.com => redirect match

While the site is in dev mode, all redirects will be 302 regardless of their configuration. This is to keep from the redirects being cached by browsers.

Importing

Import redirects using the CMS Bulk Import Form Your CSV will need the following column titles

  • FromPath: Relative path or full URL of the old page or file
  • Destination: Relative path or full URL of the new page or file