Hello all,

I am trying to enable the 301 redirection facing my new domain with drupal 7 but I'm getting the following error:

Domain 301 redirection can not be enabled as the domain you set does not currently point to this site.

Why? I am waiting your thoughts...

Comments

nagba’s picture

the module is checking if the domain is set to the current site. If it is not then it will not allow the redirecting. Make sure that the webserver vhost / symlink is set properly.

mohammed76’s picture

Assigned: gkg_ » Unassigned
Priority: Major » Normal
Status: Active » Closed (works as designed)

have you made sure that the domain you're trying to redirect is properly configured?

you don't assign an issue to yourself unless you intend to work on it.

HunSquirell’s picture

Issue summary: View changes

The module did the same error message to me until I switched off the maintenance mode. After I turned the maintenance mode off it was willing to make the new (https) redirect.

RickZ’s picture

I have the same issue, occurs last week, before that no problems.

The folowing is mentioned when I try to enable in settings/search & metadata/domain 301 redirect:

Redirects have been disabled by cron because the domain was not available at: za, 16/03/2019 - 11:23.

Errorreport
• Notice: Undefined property: stdClass::$data in domain_301_redirect_check_domain() (regel 203 van /www/htdocs/xxxxx/sites/all/modules/domain_301_redirect/domain_301_redirect.module).
• Notice: Undefined property: stdClass::$data in domain_301_redirect_check_domain() (regel 203 van /www/htdocs/xxxxx/sites/all/modules/domain_301_redirect/domain_301_redirect.module).
• Notice: Undefined property: stdClass::$data in domain_301_redirect_check_domain() (regel 203 van /www/htdocs/xxxxx/sites/all/modules/domain_301_redirect/domain_301_redirect.module).
• Domain 301 redirection can not be enabled as the domain you set does not currently point to this site.

Drupal 7.64
Domain 301 redirect 7x-1.3
Hosted VPS (Apache)
PHP 5.6 and 7.0 (error occurs on both versions)

Can someone help me out with this error?

RickZ’s picture

Status: Closed (works as designed) » Active
RickZ’s picture

To make a redirect 301 (domain or url) with an exclusion workable, for now, I have used an alternative using .htaccess.

For those who are looking for a workable alternative .........
This redirects all urls to "example.com" except the directory "sample" in the root:
RewriteCond %{THE_REQUEST} !/sample[?\s/] [NC]
RewriteRule ^ https://www.example.com [R=301,L]

Before testing: Clear your web browser's cache!

If someone has still a solution for domain 301 redirect that would be great!

bcobin’s picture

I have the same problem - why would you want to redirect to the same site if the purpose is to redirect to another domain?

Here's what I need to do:

I need to redirect all nodes with URL http://old-site.com/subdirectory/[path] to http://new-site.com/subdirectory/[path]

I enter http://new-site.com into the domain field. I enter subdirectory/* into "Only listed pages."

Upon save I get the "Domain 301 redirection can not be enabled as the domain you set does not currently point to this site."

This makes no sense. If I enter the current site, where would I enter the destination site? Am I missing something?

I'm now looking into whether I can do the same thing with .htaccess (as per the above) but am not having any luck so far.

I should mention here that I'm using Domain Access - the redirect needs to apply to only one of the two sites of the multisite, so I'd need to specify the base URL into the rewrite rules.

Any help greatly appreciated... here's hoping... thanks!

RickZ’s picture

Hi bcobin,

About "This makes no sense. If I enter the current site, where would I enter the destination site? Am I missing something?"

You have to use the domain .htaccess you want to redirect and fill in the url you want to redirect to; in the example above: example.com.

Note: if the domain you want to redirect is abc.com and want to redirect to is def.com:
Take the .htaccess of abc.com and fill in the def.com in the rewrite rule.

Hope this helps you out!

bcobin’s picture

Thanks for the quick response, Rick - much appreciated!

Domain Access shares the .htaccess file - I'm assuming that it should be straightforward to use pattern matching to have the rewrite rules apply only to one of the base URLs.

But the issue is that I need to redirect only the URLs that have paths of, say, [base-url]/lit/* and, say, [base-url]/reading_series/*

Other URLs should go straight through. Domain 301 redirection sounds ideal, but as per this thread, it's not working, at least for me.

So .htaccess looks like the way to go. Again, any guidance, etc... thanks again!