# redirection/3.0/actions/url.php

Redirection, version 3.0. 17 lines.

- Page: https://pluginprobe.com/plugins/redirection/3.0/code/actions/url.php
- Raw: https://pluginprobe.com/plugins/redirection/3.0/raw/actions/url.php
- Modified: 2017-10-08T12:32:30+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/redirection/3.0/code/actions/url.php#L10-L20`.

```php
<?php

class Url_Action extends Red_Action {
	protected function redirect_to( $code, $target ) {
		$redirect = wp_redirect( $target, $code );

		if ( $redirect ) {
			header( 'X-Redirect-Agent: redirection' );
			die();
		}
	}

	public function process_after( $code, $target ) {
		$this->redirect_to( $code, $target );
	}
}

```
