1

I have developed a module that creates a certain set of pages. What I would like to do is create a specific redirect for those pages if they are not found while keeping the generic Drupal 7 wide redirect for all other pages. Is this possible and how would I go about doing it?

Thanks.

2
  • Why would pages you have created not be found? Do you have something like myurl/<someID>, where not all possible <someID> values exist?
    – rooby
    May 11 '13 at 8:49
  • The pages are created depending on user actions. So in some instances the page may not exist yet and instead of displaying a 404, I would rather redirect them to the appropriate page.
    – user5013
    May 13 '13 at 15:37
-2

I suggest to try the Redirect or rules module.

Update:

You can create URL redirects manually for each of these pages, but the Redirect module makes this much easier.

  • Go to "Configuration > Search and metadata > URL redirects > Fix 404 pages" (admin/config/search/redirect/404).

So, you can see that there are a few paths that I have tried to access that do not exist. Next, to each one there is an "Add redirect" operation.

  • Click "Add redirect"

When Clicking on "Add redirect" link we can specify where we would like users to be redirected when they reach the page that does not exist.

See more how to Fix 404 Pages Using redirect Module.

3
  • 1
    The rules module would be the best generic solution I think.
    – user5013
    May 13 '13 at 15:38
  • How can we can page not found event in Rules?
    – AgA
    Aug 23 '13 at 10:31
  • 1
    Can you expand this a little bit to describe how these two modules can solve the problem?
    – mpdonadio
    Aug 23 '13 at 11:10
1

You can try by going on "admin/config/system/site-information"page. There you can give links where to redirect on the "Default 403 (access denied) page" and "Default 404 (not found) page". For example if you type "node", it will take you to front page.

0

Create a Page in Page Manager where you use an HTTP response code and disable all form elements on that page.

Give your path a (random) name.

Set the Response code of the Page to: 404 Page not found.

Create a rule with Rules that:

  1. fires if a hidden field on your form is filled out OR if the email address has a certain TLD e.g. ".site"

  2. removes all roles and adds a role of e.g. "spammer"

  3. blocks them

  4. and redirects them to that Page path or a website that collects spammers (I'm not sure which one)

That's how I'd do it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.