Change Permalink Custom Structure Tab – Remove category structure tag

Home Forums BulletProof Security Pro Change Permalink Custom Structure Tab – Remove category structure tag

This topic contains 5 replies, has 2 voices, and was last updated by  AITpro Admin 3 years, 4 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #20892

    Krzysztof
    Participant

    Hello!

    I have tried to get rid of one plugin which I have besides BPS PRO – https://wordpress.org/plugins/wp-no-category-base/
    I’m removing plugins which are old, not updated just to be on the safe side.

    Now what I want to achive is have no category in my URL. This would also have to work for subcategories as my site heavily depends on the categories and subcategories structure to display content. I did some Internet digging:
    http://wpcoke.com/remove-category-wordpress-url/
    http://premium.wpmudev.org/blog/removing-category-base-urls-wordpress/

    and so on – many sites, many codes. The trick with no htaccess code didn’t work although I have pasted the code displayed in settings in my htaccess and followed the deployment process. The ideal thing would be not to use any plugins and just to use htaccess or any other method – one plugin less – one less possible hole in my system. Either I do something wrong or I do not get something or there is a conflict at some point with BPS rules.

    #20896

    AITpro Admin
    Keymaster

    Both of the site links above have bad/wrong information about how to correctly change/add/use correct Permalink Custom Structure Tags.  Now have you created Categories that you want to keep and just rewrite the Posts in those Categories or have you moved all Posts out of those Categories and just need to change your Custom Permalink Structure.  Please post exact examples of what you are trying to accomplish.  ie your existing URL structure.  Your existing Categories that you created.  The end result that you want to accomplish.

    http://codex.wordpress.org/Using_Permalinks

    #20897

    Krzysztof
    Participant

    You can trust no one on the web except BPS 🙂
    Here is the thing:
    – now it looks like this:
    https://www.infolotnicze.pl/wiadomosci/
    and for subcategories:
    https://www.infolotnicze.pl/wiadomosci/lotnictwo-cywilne/
    https://www.infolotnicze.pl/historia/w-powietrzu/do-roku-1918/
    single post
    https://www.infolotnicze.pl/2014/04/28/samoloty-pfalz-w-pierwszej-wojnie-swiatowej-czesc-ii/
    co there is no “category”
    The esential thing is to keep it like this as the site is build in a way that displays special views for special categories and I think that it is somehow included in the template. There are also many many links inside our website posts that point to categories and posts with URL’s like mentioned above so any changes would brake everything and with over 11.000 posts this could end up with a disaster.
    The plugin does it’s job ok – no problems since 2 years but as I mentioned – no updates and I think that it can brake any time and then we will be in deep trouble, which means that I as Editor in chief would be in the deepest trouble as we have no IT specialist and all collapses always on my head 😉
    I thought that pasting those rules in BPS custom code would do the trick but ended up with 404 errors.

    #20898

    AITpro Admin
    Keymaster

    Yep, it is always possible that WordPress will change something in a newer version of WordPress and if a plugin or theme is not updating their code to adjust to those new changes in WordPress then that plugin or theme could all of a sudden stop working correctly.

    I looked at the code in the WP No Category Base plugin and it is simply getting the internal $wp_rewrite global and get_option('category_base') option and then doing an internal rewrite/redirect with the Category Base. You can do the same thing with htaccess code.

    Personally I do not think you have anything to worry about with WordPress changing the way they do their Internal Rewriting.  It is set in stone and will probably never change.  In other words, the WP No Category Base plugin will work forever without breaking. ;)

    If you want to create the htaccess rewrite/redirect rules/code then what you will need to do is get the URL’s before they are being rewritten/redirected and then the get the final rewrite/redirect URL. After you have that information then you can create your htaccess rewrite/redirect code. See the Reference link below for examples.

    Reference: https://forum.ait-pro.com/forums/topic/htaccess-redirect-code-where-do-i-add-redirect-htaccess-code/

    Example:
    Original URL’s that are not being rewritten/redirected:
    example.com/catA/
    example.com/catA/somewhere/

    Final rewrite/redirect URL’s:
    example.com/blah/
    example.com/somewhere-else/

    redirect everything in catA to the root site URL
    RedirectMatch 301 ^/catA$ https://www.example.com/$1

    redirect the “old post” to the “new post” and to the new category as well.
    RedirectMatch 301 ^/old-category/my-old-post$ https://www.example.com/new-category/my-new-post$1

    #20904

    Krzysztof
    Participant

    huh… to much for my head. If you write that this plugin will just work I will leave it like it is.

    Thanks for your help – as always BPS Pro team just rocks!

    #20905

    AITpro Admin
    Keymaster

    Yep, I find it very hard to imagine that WordPress would change anything about the core foundation of URL rewriting.  It would be the same thing as replacing the engine in your car.  😉

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.