Syndicate

Feed

Simple redirect using the path module

You can use the path module to force a simple redirect in Drupal. Say you have a Drupal site with only one blog. When people access the page myWebsite.com/blog, you may actually want them to see the page at myWebsite.com/blog/x where x is the ONE blogger user hi-dee. (The page at myWebsite.com/blog has for title Blogs.) A simple redirect is achievable using the path module, part of the default Drupal distribution. Go to the page myWebsite.com/admin/build/path/add, and provide a new URL alias like so — replacing the number 1 with the uid of your lonesome blogger:

Adding a URL alias

This will work in Drupal 5 and Drupal 6. You may wonder if this is 'by design'. You're specifying an existing system path as 'Path alias', and Drupal thinks that this Drupal path is indeed an alias. In my opinion, this is more of a side effect than a bug — and it is a side effect you can take advantage of whenever you wish to 'condemn' certain Drupal roads to redirect your visitors to another page.

Last edited by Caroline Schnapp about 11 weeks ago.

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Allowed HTML tags: <a> <b> <i> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <sup> <sub> <dd> <del> <blockquote> <img> <q> <p> <div>

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
15 + 0 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.