Help with redirecting old links in htaccess

Home Forums BulletProof Security Pro Help with redirecting old links in htaccess

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

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #34683

    webstar
    Participant

    Hi,

    I recently bought a website and I need to redirect all links like this:

    http://example.com/blogs/topic/blog-url

    to

    https://example.com/blog-url/

    Mind you, I already have this in my Custom WP loop

    # CUSTOM CODE WP REWRITE LOOP START
    # WP REWRITE LOOP START
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTPS} !=on
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    RewriteRule ^index\.php$ - [L]

    Can you tell me how I could add this to the Custom Code?

    Thanks.

    #34685

    AITpro Admin
    Keymaster

    What I need to know is if you need a universal redirect rule.  ie all old links will use the new redirect rule, which would require that all old URL’s still have the same URI’s and the only difference is the /blogs/topic/ URI has now changed.  Guessing that you had a forum site and now have a typical/standard WP “blog” site?

    #34687

    webstar
    Participant

    It was a Shopify site and that’s how the articles were structured. I’m removing Shopify and using WordPress.

    Anyways, yes, I want all the old article links to go to the same article name, but, the directory is slightly different in that in the new WP site, I am removing the directories. And it’s going to https as well.

    I would think Shopify uses https, but, for some reason, I see links in FB and other places the previous owner had, he was using http.

     

    #34689

    AITpro Admin
    Keymaster

    If I am guessing correctly based on your info I think what you need is this standard/general redirect rule: RedirectMatch 301 ^/blogs/topic/blog-url/$ https://example.com/blog-url/$1, which you would add/create in this BPS Root Custom Code text box: 1. CUSTOM CODE TOP PHP/PHP.INI HANDLER/CACHE CODE, click the Save Root Custom Code button and activate Root folder BulletProof Mode.

    #34690

    AITpro Admin
    Keymaster

    Oops probably use this redirect rule just in case:  RedirectMatch 301 ^/blogs/topic/blog-url/(.*)$ https://example.com/blog-url/$1

    #34695

    webstar
    Participant

    That did it, thanks!

    Just to clarify though, because there was probably a miscommunication in my writing, I wrote the redirects like this:

    RedirectMatch 301 ^/blogs/topic/(.*)$ https://example.com/$1
    #34696

    AITpro Admin
    Keymaster

    Cool glad you got it figured out.  🙂

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

You must be logged in to reply to this topic.