Best way to redirect a lot of pages from one domain to another all with same content URL

Have a site and within that site I have numerous pages within Geographic folders (North, South, East, West etc) featuring destinations.

These pages are now deleted as they have now been moved to a new site/domain.

So essentially I do have

And it’s now replicated at

So I would like to set up a redirect to all the pages from one site to another.

I have installed Redirector and I also have csv of all the URLs but I don’t think it will allow me to redirect to another domain.

Is the only way to do this via .htaccess ??


This should be possible. Just use the complete url in the target field.

Ive tried that and no luck

I’ve also tried raw csv but that fails I’ve tried various input styles with/ without semi-colon and commas

" etc


That’s odd, the UI accepts a full URL for me fine.

MODX 3.0.1-pl
Redirector 2.0.10-pl

I agree about the CSV import though - it fails on any combination I try - even for just a single line.

When a redirect is created manually and the target contains '://', there is a check with the PHP function get_headers to see if the target-URL exists.

During an CSV import, the target field is also validated, but only local URLs are allowed.

This validation has to be extended to allow for full links to other domains.

That makes sense - but the import CSV seems to fail even if a local target is chosen:


Maybe I’m misinterpreting the advice:

Notice: format of the CSV must be “pattern;target;context”, where “context” may be skipped or empty.

Also tried:


You can’t use [[~1]]. You have to use the actual alias:


Also, here is the replacement code to allow external redirects in the import:

case 'target':
	if(strpos($uri, '://') !== false) {
		$headers = @get_headers($uri);
		if(empty($headers)) {
			return false;
	} else {
		$criteria = array('uri' => $uri);
		if(!empty($context)) { $criteria['context_key'] = $context; }
		$resource = $this->modx->getObject('modResource', $criteria);
		if(empty($resource) || !is_object($resource)) {
			return false;
1 Like

Does that actually work for you @halftrainedharry ?

Yes, it does.

If there is an error, it should log an error message to the MODX error log.

Alternatively the extra SEO Suite also allows redirects. But there is no possibility to import from a file.

If nothing else works, there is always the possibility to add the data directly to the database table: modx_seosuite_redirect for SEO Suite or modx_redirects for Redirector.

This was really baffling me - turns out I didn’t have FURLs enable on my test site so all targets were getting rejected using the CSV import.

I can see it works now and also that your fix above allows the addition of full external links :+1:

Hopefully that will work for @gavinbaylis too

WebLinks should also forward to external pages as long as the content field holds a full URL. That might be easier to implement. You should be able to just convert the old pages to WebLinks and put the new URL in their content field.

Where do I place that specific code please?

Currently, I’m changing each page individually and it’s getting rather tedious :frowning:

Ignore that above, I’ve worked it out, now to see if it works!

In the file core/components/redirector/processors/mgr/import/import.class.php in the function “validate” (lines 114 to 125).

Still had four failed with this quick import


I’m not sure why it fails (The targets seem to exist. Maybe check the MODX error log).

If you are really sure that the data is correct, then just change the code in the validate function to always return true;