WordPress.org

Ready to get started?Download WordPress

Forums

BulletProof Security
[resolved] 301 Not Working After Install (7 posts)

  1. Murray644
    Member
    Posted 1 year ago #

    So I moved from Blogger to WordPress and all my posts were being redirected fine for 2 weeks with my 301 redirect but as soon as I installed BPS all my old links go to 404! Please help!!!!

    I uninstalled BPS but its still all messed up!?

    http://wordpress.org/extend/plugins/bulletproof-security/

  2. AITpro
    Member
    Plugin Author

    Posted 1 year ago #

    How were the 301 redirects being done? Did you have an .htaccess file that was doing the 301 redirects? What posts were being redirected from where to where? Please add some specific technical details and/or real URLs or example URLs.

    To completely remove BPS please follow these steps below.

    BPS removal steps:

    1. Activate Default Mode on the Security Modes page.
    2. Use the Delete wp-admin .htaccess feature on the Security Modes page.
    3. Deactivate and delete BPS on the WP Plugins page.

    or if you have already deleted the plugin files then manually delete your root .htaccess file and your wp-admin .htaccess file.

    Then go to Settings >>> Permalinks and update your Permalinks.

  3. Murray644
    Member
    Posted 1 year ago #

    To redirect I added a php file to my theme and then added the 301 redirect code to the html section of Blogger so no I never touched the actual .htaccess file for the redirection.

    I did follow the steps above for removing but still no redirect! Then I manually deleted some BPS files that were still in my wp files and switched over to use a plugin for the redirect and things are back to redirecting!

    I really would like to use BPS, is there a reason it would cause redirects not to work? Code I need to add?
    Thanks

  4. AITpro
    Member
    Plugin Author

    Posted 1 year ago #

    Ok so you added some kind of php file/coding to your WordPress Theme (probably your functions.php file or maybe header.php?) that does something with handling redirection and then you added some kind of additional 301 redirect code on your Blogger site somewhere. Not sure what this means "the html section of Blogger".

    Then I manually deleted some BPS files that were still in my wp files...

    Are you saying above that you deleted the root .htaccess file and the wp-admin .htaccess file?

    I don't have enough technical specific details/information from you yet to give you an exact accurate answer at this point. If i tried to guess without knowing exact details then it would be a pretty big list of possibilities.

    Please post your redirection code and provide specific details such as exact file names, exact file locations, etc.

  5. Murray644
    Member
    Posted 1 year ago #

    Alright, sorry I used a tutorial (it was common among most tutorials on redirecting from Blogger to WordPress). Here is that just so you can see the code but I will also paste below.

    I created a php file and put it in my theme folder:

    <?php
    
      Template Name: blogger
     */
    
     global $wpdb;
     $old_url = $_GET['q'];
    
     if ($old_url != "") {
       $permalink = explode("blogspot.com", $old_url);
    
       $q = "SELECT guid FROM $wpdb->posts LEFT JOIN $wpdb->postmeta ".
            "ON ($wpdb->posts.ID = $wpdb->postmeta.post_id) WHERE ".
            "$wpdb->postmeta.meta_key='blogger_permalink' AND ".
            "$wpdb->postmeta.meta_value='$permalink[1]'";
    
      $new_url = $wpdb->get_var($q)? $wpdb->get_var($q) : "/";
    
      header ("HTTP/1.1 301 Moved Permanently");
      header("Location: $new_url");
     }
    ?>

    Then I created a new page (blank) and was able to choose "blogger" from the wordpress template drop down due to the php file I added.

    Then I went to Blogger-Edit Html and pasted:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
       dir="<$BlogLanguageDirection$>">
    <head>
    <title><$BlogPageTitle$></title>
    
    <script type="text/javascript">
     <MainOrArchivePage>window.location.href='http://labnol.org/'</MainOrArchivePage>
     <Blogger><ItemPage>
       window.location.href='http://labnol.org/blogger/?q=<$BlogItemPermalinkURL$>'
     </ItemPage></Blogger>
    </script>
    
    <MainPage><link rel="canonical" href="http://labnol.org/" /></MainPage>
    <Blogger><ItemPage>
     <link rel="canonical" href="http://labnol.org/blogger/?q=<$BlogItemPermalinkURL$>" />
    </ItemPage></Blogger>
    </head><body>
    
    <div style="border:#ccc 1px solid; background:#eee; padding:20px; margin:80px;">
    <p>This page has moved to a new address.</p>
    
    <h1>
     <MainOrArchivePage>
      <a href="http://labnol.org"><$BlogTitle$></a>
     </MainOrArchivePage>
     <Blogger>
       <ItemPage>
        <a>"><$BlogItemTitle$></a>
       </ItemPage>
     </Blogger>
    </h1>
    
      </div>
     </body>
    </html>
    
    <!-- replace labnol.org with your WordPress site URL --->

    This worked I checked old links, googled posts I knew would come up in the search engine and was re-directed but again as soon as I installed BPS no links redirected!

    I did not delete any wp files and I did not delete my .htaccess file. I only deleted 2 BPS folders that were left after I followed the complete removal direction and then my re-directs worked again!

    Thanks for your help I'd love to be able to figure it out so I can re-install!

    [Moderator Note: Please post code or markup snippets between backticks or use the code button. Or better still - use the pastebin. As it stands, your code may now have been permanently damaged/corrupted by the forum's parser.]

  6. AITpro
    Member
    Plugin Author

    Posted 1 year ago #

    Well you can create .htaccess redirect coding or use a plugin like Simple 301 redirects to create redirection coding, but i think at this point BPS is probably not the plugin for your needs. ;) And nope i cannot recommend another security plugin - this always gets me into trouble sorry.

  7. AITpro
    Member
    Plugin Author

    Posted 1 year ago #

    I didn't here back from you for a couple of days so i assumed that this thread can be resolved. Thanks.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic