1

I just moved a website to drupal 7 and I have problems with the redirects.

The old website had all urls like this: www.example.com/index.php?var1=aaa&var2=bbb (where aaa and bbb changed for the different pages)

In the new Drupal website I use alias, so for example the page: www.example.com/index.php?var1=aaa&var2=bbb now it is replaced by www.example.com/content/something

I tried to redirect the old url to the new one with two different methods, but both failed. They redirect the users to the homepage.

  1. I create an alias
  2. I added a rewrite rule in the .htaccess file RewriteRule /index.php?var1=aaa&var2=bbb /content/something

As I said, both of them redirect to the homepage.

Any idea? thanks!

3
  • Consider using example.com - that's the domain created to be used in documentation, questions, answers and all that whenever you don't want to give your real one. See this meta question and it's accepted answer for rationale and clarifications :)
    – Mołot
    Commented Dec 30, 2013 at 11:35
  • 1
    I am thinking it is because drupal already rewrites paths and any path that doesn't actually exist, eg, is a real file in your filesystem, gets sent to drupal's index.php for handling. So.... you are probably going to have to rewrite them to drupal system paths, eg, rewrite index.php?var1=..... to index.php?q=node/# which is drupal's way of dealing with things. alas, that will be pretty extensive, so you may want to consider a module that does this for you instead of hard coding in .htaccess.
    – Jimajamma
    Commented Dec 30, 2013 at 14:25
  • thank you boyh. Jimajamma, ok, I could that with a module... can you give me some advice on how which functions do I have to use inside that?
    – lorenzo
    Commented Dec 30, 2013 at 14:54

1 Answer 1

0

Redirect is the drupal 7 version of path redirect. Path redirect This module allows you to specify a redirect from one path to another path or an external URL, using any HTTP redirect status. and GlobalRedirect is a simple module which… Checks the current URL for an alias and does a 301 redirect to it if it is not being used. Checks the current URL for a trailing slash, removes it if present and repeats check 1 with the new request. Checks if the current URL is the same as the site_frontpage and redirects to the frontpage if there is a match. Checks if the Clean URLs feature is enabled and then checks the current URL is being accessed using the clean method rather than the 'unclean' method. Checks access to the URL. If the user does not have access to the path, then no redirects are done. This helps avoid exposing private aliased node's. Make sure the case of the URL being accessed is the same as the one set by the author/administrator. For example, if you set the alias "articles/cake-making" to node/123, then the user can access the alias with any combination of case. Most of the above options are configurable in the settings page. In Drupal 5 you can access this after enabling the globalredirect_admin module. In Drupal 6, the settings page is bundled into the module.

2
  • path redirect doesn't exist for Drupal 7
    – lorenzo
    Commented Dec 30, 2013 at 14:56
  • See my edit on answer.
    – madhurjya
    Commented Dec 30, 2013 at 15:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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