Volete cambiare il prefisso di base della categoria in WordPress?
Per impostazione predefinita, WordPress aggiunge automaticamente /category/ come prefisso agli URL di tutte le pagine di categoria. Tuttavia, è possibile modificare facilmente il prefisso di base della categoria o rimuoverlo completamente.
In questo articolo vi mostreremo come cambiare il prefisso di base della categoria in WordPress.
Che cos’è il prefisso di base della categoria? Dovreste cambiarlo?
Ogni categoria del vostro sito WordPress ha una propria pagina e un proprio feed RSS. È possibile visualizzare tutti i post archiviati in una categoria visitando la pagina dell’archivio della categoria stessa.
Per impostazione predefinita, WordPress aggiunge “categoria” come prefisso di base agli URL delle pagine di categoria. Questo aiuta a differenziare le pagine e i post dagli archivi di categorie e tag.
Ad esempio, se si dispone di una categoria chiamata “Notizie”, il suo URL avrà il seguente aspetto:
http://example.com/category/news/
Allo stesso modo, WordPress aggiunge i prefissi dei tag agli URL degli archivi di tag.
http://example.com/tag/iphone/
Questa struttura URL SEO-friendly aiuta gli utenti e i motori di ricerca a capire che tipo di pagina stanno visitando.
Per la maggior parte dei siti web non è necessario modificare il prefisso di base. Tuttavia, se si sta creando un sito di nicchia in cui si desidera utilizzare una parola o una frase diversa per le categorie, è possibile modificare il prefisso di base della categoria in modo da riflettere tale scelta.
Cambiare il prefisso di base della categoria in WordPress
La modifica del prefisso di base della categoria è abbastanza semplice in WordPress.
È necessario visitare la pagina Impostazioni ” Permalinks dalla dashboard di WordPress e scorrere fino alla sezione “Opzionale”.
Nel campo “Base della categoria” è possibile inserire il prefisso che si desidera utilizzare accanto all’opzione base della categoria. È anche possibile modificare il prefisso della base dei tag, se lo si desidera.
Ad esempio, è possibile aggiungere “argomenti” come nuovo prefisso. In questo caso, gli URL delle categorie avranno il seguente aspetto:
http://example.com/topics/news/
Non dimenticate di fare clic sul pulsante “Salva modifiche” per memorizzare le impostazioni.
Rimozione del prefisso di base della categoria dagli URL
Molti dei nostri utenti ci hanno chiesto di rimuovere completamente il prefisso di base della categoria dagli URL di WordPress. In questo modo gli URL delle categorie assumeranno l’aspetto seguente:
http://example.com/news/
Questa non è una buona idea e si consiglia di non rimuovere il prefisso di base della categoria.
Il prefisso di base della categoria aiuta sia gli utenti che i motori di ricerca a distinguere tra post/pagine e categorie. La rimozione del prefisso rende gli URL ambigui, il che non è positivo né per l’esperienza utente né per la SEO di WordPress.
Potreste anche incorrere in problemi tecnici con vari plugin di WordPress. Ad esempio, se avete una categoria e una pagina con lo stesso nome o se utilizzate %postname% come struttura URL per i singoli post, il vostro sito subirà un ciclo di reindirizzamento infinito che causerà il mancato caricamento delle pagine.
Tuttavia, se si desidera comunque farlo, è possibile utilizzare il plugin All in One SEO (AIOSEO).
È il miglior plugin SEO per WordPress e rende super facile l’ottimizzazione del sito web per i motori di ricerca. Inoltre, offre la possibilità di eliminare il prefisso di base della categoria con un semplice clic.
Per questo tutorial, utilizzeremo la licenza AIOSEO Pro, che include la funzione di rimozione della base delle categorie e altre potenti opzioni come il gestore di reindirizzamento e l’assistente ai link. Esiste anche una versione gratuita di AIOSEO che potete utilizzare.
Per prima cosa, è necessario installare e attivare il plugin AIOSEO. Per maggiori dettagli, consultate la nostra guida su come installare un plugin di WordPress.
Dopo l’attivazione, verrà visualizzata la procedura di configurazione guidata di AIOSEO. È sufficiente fare clic sul pulsante “Cominciamo”. Per ulteriori informazioni, potete consultare la nostra guida su come configurare All in One SEO per WordPress.
Successivamente, potete andare su All in One SEO Search ” Appearance dal pannello di amministrazione di WordPress e fare clic sulla scheda ‘Taxonomies’.
Successivamente, andare alla sezione Categorie e passare alla scheda “Avanzate”. Da qui, è sufficiente fare clic su Sì per l’opzione “Rimuovi il prefisso di base della categoria”.
Non dimenticate di fare clic sul pulsante “Salva modifiche” quando avete finito.
Impostazione dei reindirizzamenti dopo la modifica del prefisso di base della categoria
Se state cambiando o rimuovendo il prefisso di base della categoria su un nuovo sito web WordPress, non dovete fare nulla. Tuttavia, se lo fate su un sito web esistente, gli utenti che visitano la vecchia pagina di categoria vedranno un errore 404.
Per risolvere questo problema, è necessario impostare un reindirizzamento per assicurarsi che sia i motori di ricerca sia i visitatori abituali siano correttamente reindirizzati alla pagina della categoria corretta sul vostro sito.
Il modo più semplice per impostare il reindirizzamento in WordPress è utilizzare il plugin All in One SEO (AIOSEO).
Per iniziare, potete andare su All in One SEO ” Reindirizzamenti dal pannello di amministrazione di WordPress e poi fare clic sul pulsante “Attiva reindirizzamenti”.
Una volta attivo, si può andare alla scheda “Reindirizzamenti” per impostare il reindirizzamento.
È sufficiente inserire l’URL che si desidera reindirizzare nel campo “URL di origine” e la nuova posizione del link nel campo “URL di destinazione”.
Per quanto riguarda il tipo di reindirizzamento, è possibile selezionare “301 Moved Permanently” dal menu a discesa. In questo modo le pagine della vecchia categoria verranno spostate in modo permanente nella nuova destinazione.
Non dimenticate di fare clic sul pulsante “Aggiungi reindirizzamento” quando avete finito.
Per maggiori dettagli, consultare la nostra guida per principianti sulla creazione di redirect 301 in WordPress.
Ora tutti gli utenti e i motori di ricerca saranno reindirizzati agli URL corretti utilizzando il nuovo prefisso di categoria.
Speriamo che questo articolo vi abbia aiutato a capire come cambiare il prefisso di base della categoria in WordPress. Potreste anche voler consultare il nostro elenco dei suggerimenti, trucchi e hack di WordPress più richiesti e come avviare un negozio online.
Se questo articolo vi è piaciuto, iscrivetevi al nostro canale YouTube per le esercitazioni video su WordPress. Potete trovarci anche su Twitter e Facebook.
Syed Balkhi says
Hey WPBeginner readers,
Did you know you can win exciting prizes by commenting on WPBeginner?
Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
You can get more details about the contest from here.
Start sharing your thoughts below to stand a chance to win!
Afaq Ahmad Khan says
When i set “Category base” with “%category%” in permalink it works fine but all other posts and page going in 404.
I have to set “Category base” with “%category%”. How can it be achieve?
Aasif Ganaie says
I want to change “category” base in “news” as well as “tag” into “topic” on a WordPress website. Will this method work in Yoast redirects as I don’t want to use a separate plugin?
Meghan says
Instead of having URL.com/tag.. I want to change it to URL.com/category/tag but I can’t seem to do this. Can you easily explain how to achieve this?
Paul Minors says
Hi there. Great article. I’m looking at doing something similar, but I’m not changing the category or tag base. I’m changing the base of “portfolio” pages. There isn’t an option to edit the case in the permalink settings. Is there another way to edit bases in my wordpress files?
Karunakar says
How to add a custom text to tag url slug?
For example:
my tag_base is “beginner”
my tag is: “wp”
Then normally url becomes: example.com/beginner/wp
Here I want to add text “help” to the slug of tag “wp” to make url as:
example.com/beginner/wp-help
I don’t want to go with a single tag slug edit. I want to append “-help” to all existed tags slugs and upcoming tags.
How can i do it?
Please help.
Thank you.
spezially says
Hi ,
what’s the easiest way if I wanted to have my general post page + all the posts that refer to the general post category bring up a prefix (ex.: news.example.com . news.example.com/single-post )
?
so far the only solution I can think of is a 301 redirect in htaccess but I’m looking for something smoother….
Conal Stubbs says
I’ve found a somewhat odd way of removing the category part.
Just to explain, I’m creating a portfolio site with a category called ‘blog’ for blogposts / latest news and one called ‘work’ for completed design projects. Obviously the desired effect is to have the url as example.co.uk/blog (or work) rather than example.co.uk/category/blog, which looks just a bit naff I’m sure you’ll agree.
By simply putting a full stop in the category base entry field WordPress seems to ignore this requirement in the url and creates the leaner, cleaner version that was wanted.
Has anyone else seen this before? Do they know of any issues with it? I’m just getting to grips with WordPress having taught myself HTML, CSS and PHP, so I’ve only tried it on a local setup and with the twenty eleven theme.
WPBeginner Support says
This is an interesting approach. Did you consider using category archive templates, like category-blog.php and category-work.php? After using these templates you can use WordPress seo plugin to remove category slug from url and you will get your blog posts on example.com/blog and Work posts on example.com/work.
Admin
ashley says
perfect. thanks!
dinesh kumar says
it’s working but only one category not all category
i am use another category page will get a 404 (not found) error when trying to access the page again.
please update here
I want url overwriter
Santiago says
In this blog did you have problems? I can see that you remove the category base and looks pretty good. Could tell us how you do this?
WPBeginner Support says
If you are using WordPress SEO you can go to SEO » Permalinks check the box that says Strip the category base (usually /category/) from the category URL.
Admin
iAn says
I updated my WordPress SEO Plugin today and I got this message:
“The feature for stripping the category base will be removed in version 1.6 of WordPress SEO. We suggest using FV Top Level Categories if you insist on keeping this but do know that the feature is very error prone and not that important for your SEO.”
I guess you are using such feature too.
I worry that I will lose ranking if I “unstrip” the category in the URL. Any suggestion for this?
Arup Ghosh says
Thanks to SEO plugins like yoast, they have added an option for this on their current version.
gnuboss says
Thanks for the info, this is a quick and simple, although often overlooked way to sort the category and tag base issues out..
To entirely remove the Category base I used to use a plugin called WP No Category Base which worked well, but can cause problems when you have a page and category with the same name – E.g. Page = Hosting (domain.com/hosting/) and a Category = Hosting (domain.com/hosting/) – but using .html suffix may help — but there are bound to be implications.
web design cheltenham says
I always like to use the .html suffix as well as changing the prefix – thanks for sharing – a simple but effective technique!
Name Removed [TOS Violation] says
If you want to do this, you should probably do this right when you begin your blog.
Otherwise, search engines which have indexed your
example.com/tags/some-tag
page will get a 404 (not found) error when trying to access the page again.
Some SEO plugins handle this case and give a 302 (redirect) status when you change a permalink, but I’m not sure about tag URLs.
Nimit Kashyap says
I didn’t know that it was so easy to change.