Treehouse: Grow your CSS skills. Land your dream job.

Redirect .php extensions to new page using htaccess

  • # August 12, 2012 at 8:05 pm

    I have a site with a fresh WordPress isntall that has a lot of old .php pages that need to be redirected. (A blank statement that just drops the .php extension won’t work, I need to target specific pages).

    /testpage.php needs to go to /test-page-new

    I’ve already set up htaccess 301 redirects for /test.html to /test which work just fine, but the .php extensions aren’t transferring.

    Do I need to use Rewrite and if so how do I implemetnt it with the existing rules generated by WordPress?


    # August 12, 2012 at 11:04 pm

    You need to make sure that the redirects that are added to your .htaccess file sit before the WordPress RewriteRule’s otherwise that will seek out the PHP files before your redirects do.

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

You must be logged in to reply to this topic.