Reputation: 1166
I have a WordPress blog with posts that has categories, this could be an example of my url:
www.example.it
The url for my post is now:
www.example.it/sample-post
The url for my category list of posts is now:
www.example.it/category/my-category
I would like my urls like this:
wwww.example.it/sample-post (for posts)
www.example.it/my-category (for categories)
After googled I founded this solution that I tried:
Go to Setting > Permalinks
Select Custom Structure
Add /%category%/%postname%/ after your domain
Change Category Base to period/dot.
In this way the category url is correct:
www.example.it/my-category
but post url is not:
www.example/my-category/sample-post
What could I change for get the url like I want?
Upvotes: 3
Views: 3838
Reputation: 577
Restore the permalink selecting "Post name" and then install this plugin. No configuration needed, it replaces the word "category" in the url of category template.
https://wordpress.org/plugins/no-category-parents/
Upvotes: 1
Reputation: 1296
Remove %category%
from your permalink structure and install Remove Category URL plugin.
Upvotes: 0
Reputation: 279
You don't need PHP to do this, just go to Settings->Permalinks and select "Post name".
If you want to make some custom link structure, please take a look at Wordpress Codex
Upvotes: 3