Title: redirect with variable %title%
Last modified: March 30, 2023

---

# redirect with variable %title%

 *  [mrvs2021](https://wordpress.org/support/users/mrvs2021/)
 * (@mrvs2021)
 * [3 years, 2 months ago](https://wordpress.org/support/topic/redirect-with-variable-title/)
 * This is my new structure.
   [https://mrpatin.bienvenidoal.club/recambios/electronica-y-motores/acelerador-cecotec-outsider-bongo-serie-a-color-azul/](https://mrpatin.bienvenidoal.club/recambios/electronica-y-motores/acelerador-cecotec-outsider-bongo-serie-a-color-azul/)
   Placing category and product name in the url.
 * This is the old structure:
   [https://mrpatin.bienvenidoal.club/producto/acelerador-cecotec-outsider-bongo-serie-a-color-azul/](https://mrpatin.bienvenidoal.club/producto/acelerador-cecotec-outsider-bongo-serie-a-color-azul/)
 * How do I redirect the old URL to the new one?
 * I have placed this redirect in .htacces , but it gives me internal server error.
 * Redirect product/%postname% to [https://mrpatin.bienvenidoal.club/%category%/%postname%](https://mrpatin.bienvenidoal.club/%category%/%postname%)
 * Any ideas ?
 * Thank you
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fredirect-with-variable-title%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [3 years, 2 months ago](https://wordpress.org/support/topic/redirect-with-variable-title/#post-16613967)
 * You cannot use .htaccess to add a category element to the request. It has no 
   way of knowing what the right category is. The issue is when someone requests/
   producto/producto_name/, WP will treat it like a category request and fail to
   find anything. You need to intercept such requests through the “request” filter.
   Verify the request via query that it’s indeed a product and not an actual category.
   If so, get the correct category term and construct a proper URL for the product.
   Then call `wp_redirect()` using the proper URL.
 * If the request is indeed for a category, return the passed query var array unchanged.
 *  Thread Starter [mrvs2021](https://wordpress.org/support/users/mrvs2021/)
 * (@mrvs2021)
 * [3 years, 2 months ago](https://wordpress.org/support/topic/redirect-with-variable-title/#post-16614448)
 * Thanks a lot . I understand now . I’m going to do it with a snippet

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘redirect with variable %title%’ is closed to new replies.

 * In: [Networking WordPress](https://wordpress.org/support/forum/multisite/)
 * 2 replies
 * 2 participants
 * Last reply from: [mrvs2021](https://wordpress.org/support/users/mrvs2021/)
 * Last activity: [3 years, 2 months ago](https://wordpress.org/support/topic/redirect-with-variable-title/#post-16614448)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
