AnswerBun.com

Remove/hide a specify category-name from the url

WordPress Development Asked by andresgl on January 4, 2022

I have several categories post:

General
News
Comedy
Competitions
Culture
Gaming
Food
etc

The posts url are in the following format:

www.mydomain.com/category-name/post-title

Example:

www.mydomain.com/food/how-to-make-paella
www.mydomain.com/gaming/game-of-theday

But I would like to hide from the URL the category name ‘general’ so for example.

instead of

www.mydomain.com/general/how-to-learn-spanish

have

www.mydomain.com/how-to-learn-spanish

I have tried some wiring a rewrite rule in the .htaccess but doesn’t work.

Any idea how can I do it?

Thanks!

2 Answers

Have you tried following Rewrite rule in your .htaccess ?

RewriteRule ^category/(.+)$ http://YOUR_SITE_NAME/$1 [R=301,L]

Answered by JItendra Rana on January 4, 2022

You can use post name in your permalinks setting. And for Category Base and Tag Base make it blank

Hope this will help

Answered by Aftab on January 4, 2022

Add your own answers!

Related Questions

Co-authors plus problems with query_post

1  Asked on October 30, 2021 by wallace-ferreira

 

wp_get_archives() not working for my custom post type

1  Asked on October 30, 2021 by best-dev-tutorials

   

Run Username SQL Query from WordPress Child Theme Functions File

1  Asked on October 30, 2021 by moa-andersen

   

Change wordpress admin home page

1  Asked on October 30, 2021 by bendict-mutua

 

How to move a post from one category to another

1  Asked on October 30, 2021 by sajeergraphix

     

Query custom post type custom meta key

1  Asked on October 30, 2021 by user1551496

     

Ask a Question

Get help from others!

© 2023 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP