There is often the necessity to redirect a customer from the site for any reasons.
There are several different ways how to do the redirect to a certain page in Magento.
Here is the example of one of this ways in Magento:
$url=http://magento/register; $this->getResponse()->setRedirect($url);
From the very beginning we make you surprised with one of the ways of such redirects (rewrites), but now we are going to clarify some moments of Magento redirects.
You can use Magento Rewrite Management for creating rewrites for products and categories, and custom rewrites for other pages in your store. And when the redirect is active, any links that point to the previous URL are redirected to a new address.
Please, pay attention to the following examples which show that all rewrites reference a "Target Path" and "Requested Path":
Example 1

Target Path: category-1.html
Requested Path: catalog/category/id/6
Redirect Type: Permanent 301

Example 2

Target Path: catalog/category/id/6
Requested Path: product.html (for an internal page)
http://magentocommerce.com (for an external website)
Redirect Type: Permanent 301

These examples are described on the Magento official site here:
http://www.magentocommerce.com/knowl...g-url-rewrites
So, let’s investigate the creation of three redirects types:
Product rewrite;
Catalog rewrite;
Custom rewrite.
How to add a product rewrite:
1. You should go to your Magento admin panel and select Catalog > URL Rewrite Management.
2. Click the Add URL Rewrite button at the top right corner.
3. In the Add New URL Rewrite section, set Create URL Rewrite to "for Product."
4. Choose the product from the list below and click to open the record.
5. Click on the Skip Category Selection button scrolling down to the button of the Category Selection.
6. You should do the following steps in the URL Rewrite section:
a. Enter the new value for the updated URL in the Request Path field. The Request Path must be unique for each rewrite.
b. Set Redirect to one of the following:
 Temporary (302)
 Permanent (301)
c. For your own reference, enter a brief description of the rewrite.
Then you should click on the Save button.

Congratulations! You have created the product redirect. Let’s investigate the other instructions connected with the Category rewrite and custom rewrite.

How to add a category rewrite:
1. You should log into your Magento admin panel and select Catalog > URL Rewrite Management.
2. Click the Add URL Rewrite button at the top right corner.
3. Set Create URL Rewrite to "for Catalog" in the Add New URL Rewrite section.
4. You should choose the category that needs the rewrite in the category tree.
5. You should do the next steps in the URL Rewrite section:

a. In the Request Path field, enter the new value for the updated URL. The Request Path must be unique for each rewrite.

b. Set Redirect to one of the following:
2. Temporary (302)
3. Permanent (301)
c. For your own reference, enter a brief description of the rewrite.

6. Please, click the Save button when you finish the actions.
How to add a custom rewrite:

1. You should log into your Magento admin panel and select Catalog > URL Rewrite Management.
2. Click the Add URL Rewrite button at the top right corner.
3. Set Create URL Rewrite to "Custom" in the Add New URL Rewrite Information section.
4. You should do the next steps in the URL Rewrite Information section:
a. Enter the unique identifier of the original URL in the ID Path field. In order to redirect any page in your store, enter the relative path to the page. For example: brand/search/result/brandname
b. Enter the same original URL in the Request Path field. The Request Path must be unique for each rewrite.
c. Enter a valid URL for the new destination In the Target Path field. In order to redirect to another CMS page in your store, enter the relative path to the new page, without a leading forward slash. To redirect to a page on another site, enter the fully qualified URL of the new destination. For example:
 new-page (URL Key of target page)
 somewhere/new-page (Relative path to target page, without a leading forward slash)
http://magentocommerce.com (Fully qualified URL of target page on external website)
d. Set Redirect to one of the following:
 Temporary (302)
 Permanent (301)
e. Enter a brief description of the rewrite.
5. Please, click the Save button when the actions are finished.

The information is taken from the official Magento site:
http://www.magentocommerce.com/knowl...g-url-rewrites

Also, you can find other useful topics there connected with the rewrites.
If you have any questions or need help, please contact GoMage specialists.

View more threads in the same category: