Home › Forums › BulletProof Security Pro › Help with redirecting old links in htaccess
- This topic has 6 replies, 2 voices, and was last updated 5 years, 3 months ago by
AITpro Admin.
-
AuthorPosts
-
webstar
ParticipantHi,
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.
AITpro Admin
KeymasterWhat 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?
webstar
ParticipantIt 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.
AITpro Admin
KeymasterIf 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.AITpro Admin
KeymasterOops probably use this redirect rule just in case:
RedirectMatch 301 ^/blogs/topic/blog-url/(.*)$ https://example.com/blog-url/$1
webstar
ParticipantThat 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
AITpro Admin
KeymasterCool glad you got it figured out. 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.