[Resolved] Where to add 301 Redirects?
I’m trying to figure out where I can add several redirects? I’m just trying to redirect an old page to the new page.
I tried doing it at a few places, but it’s not working. Not sure if it’s a plugin problem or a host problem. Thoughts?
This is an online htaccess redirect code generator >>> http://www.htaccessredirect.net/
It is going to depend on what you are trying to redirect and to where.
Please post specific examples of what you are trying to do. Also are the redirects inside the WordPress rewrite loop or outside the WordPress rewrite loop?
//301 Redirect Old File
Redirect 301 somefile.php somefile-new-location.php
//301 Redirect Entire Directory
RedirectMatch 301 /some-folder/(.*) /some-new-folder-location/$1
Did this info answer your question? If so, please resolve this question. Thanks.
Ok well i guess you are crazy busy so i am resolving this thread. please reopen it if you need any other info. Thanks.
Well, the redirects are sort of outside the loop. This is a redirect I’d like to happen:
I see the link you gave me. What would you like me to do with the code that it generates? Where would that go?
Ok then you would do something like this then if you are in the scenario of generally trying to redirect ALL old html pages from a site that was previously an HTML site to a new site that is now WordPress.
You would add your redirect code to BPS Custom Code, save this code, then click the AutoMagic buttons and activate BulletProof Mode for your Root folder again.
Root htaccess File Custom Code
CUSTOM CODE TOP: Add php.ini handler code and / or miscellaneous custom code here
…Add your new redirect custom code here…
how many pages total do you have to redirect? it might be better to just do the redirects individually if you only have a small number of them – 100 pages or less to redirect.
so if you want the simplest and most basic redirect method for a small number of redirects then here it is:
This redirects a file named example-page.html that is in the website root folder to a blog post named conveyors. Your redirect for home_r1.html to blog post conveyors is also shown.
RedirectMatch 301 /example-page.html /conveyors/index.php or without displaying index.php RedirectMatch 301 /example-page.html /conveyors/ RedirectMatch 301 /home_r1.html /conveyors/index.php or without displaying index.php RedirectMatch 301 /home_r1.html /conveyors/
I assume this answered all of your questions. Resolving this thread. Thanks.
Thank you for the information!
I have followed your instructions with regard to using the custom code and for the first time (from the various methods I have tried), the redirect is working. However, the redirect is going to the main page, rather than the desired page.
This is all on the same domain… I am cleaning up old .php and .html pages that have been replaced with WordPress pages.
Is there another setting that is forcing redirects to the main page?
This is the redirect I tested with:
Redirect 301 /immunocal.science.php http://www.immunocal.md/science/
When I go to the old URL, I arrive at immunocal.md
What is my next step?
Use RedirectMatch instead of redirect and in your case it is important to escape the dot otherwise the dot will match more than just a single/literal dot and match anything. I am not sure why you were adding the domain name. You are just trying to match and redirect the file named science.php correct?
RedirectMatch 301 ^/science\.php$ http://www.immunocal.md/science/
No, the original page is http://immunocal.md/immunocal.science.php
In fact, the very first page was with .html extension, so I have to redirect that one also. I have a whole list of pages to redirect.
Well that might be a problem since your file name is the same as your domain name and could cause a redirect loop, but it may not – very strange file name??? Try it…
RedirectMatch 301 ^/immunocal\.science\.php$ http://www.immunocal.md/science/
- The topic ‘[Resolved] Where to add 301 Redirects?’ is closed to new replies.