Ivan Zugec

Drupal Consultant

Redirect taxonomy term links to a views page

On some Drupal sites having the taxonomy links point to the "taxonomy/term/tid" can really break the design of a site. Sometimes you want to redirect the user to a custom views page instead of the standard taxonomy page.

Using the Taxonomy Redirect module it's relatively easy to change the taxonomy URL.

To install Taxonomy Redirect go to http://drupal.org/project/taxonomy_redirect and download the module. Unzip the module into "sites/all/modules".
Once installed go to Administer >> Site Building >> Taxonomy Redirect to create your redirects.

![fig 1](/sites/default/files/zugec/tr_fig1.jpg)

For this example I have created a views page which passes the taxonomy ID via the URL (stories/!tid).

So if I go to URL example.com/stories/1 it will show all nodes which have been taged with taxonomy ID 1.

![fig 2](/sites/default/files/zugec/tr_fig2.jpg)

To create the redirect just go to Administer >> Site Building >> Taxonomy Redirect.

Under the **Add new redirect**, select the vocabulary you want to redirect.

![fig 3](/sites/default/files/zugec/tr_fig3.jpg)

Then in the **Path** text field enter in "stories/!tid". The system will replace "!tid" with the taxonomy term ID.

![fig 4](/sites/default/files/zugec/tr_fig4.jpg)

Scroll down to the bottom and click on **Submit**. If you need to edit any redirects just click on the **load into editor** link.

![fig 5](/sites/default/files/zugec/tr_fig5.jpg)

Now if you go and click on any taxonomy terms they all should redirect to "stories/!tid" instead of "taxonomy/term/!tid".

If you have any feedback or need help please leave a comment.

About the author: Ivan Zugec
Ivan Zugec's picture

Ivan is a Sydney Australia based Drupal Developer with over 5 years experience.

Follow:
Version: 

Add new comment