WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] htaccess redirect blog post that once had no category (2 posts)

  1. mattmaldre
    Member
    Posted 6 months ago #

    I'd like to redirect this url:
    http://www.tribunecontentagency.com/video-game-console-sales-will-soar-holiday-season/
    to this url:
    http://www.tribunecontentagency.com/blog/video-game-console-sales-will-soar-holiday-season/

    I've tried this at the top of my htaccess (above the WordPress stuff):

    #301 Redirect Old File
    Redirectmatch 301 /video-game-console-sales-will-soar-holiday-season/ http://www.tribunecontentagency.com/blog/video-game-console-sales-will-soar-holiday-season/
    
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress

    But it creates a redirect loop. How can make this redirect work?

  2. mattmaldre
    Member
    Posted 6 months ago #

    A friend gave me the solution:

    #301 Redirect Old File
    RedirectMatch 301 ^/video-game-console-sales-will-soar-holiday-season/(.*) http://www.tribunecontentagency.com/blog/video-game-console-sales-will-soar-holiday-season/$1
    
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress

    Hooray! It works!

Reply

You must log in to post.

About this Topic