Support » Fixing WordPress » Move rewrite rule to functions.php

  • I’d like to move my .htaccess rewrite rule to my functions.php, but I’m having trouble doing so. Thanks.

    RewriteEngine On
    #RewriteRule ^photos/gallery/image/([^/]*)/$ /wp-content/themes/ior/page-gallery-image.php?i=$1 [L]
    #RewriteRule ^photos/gallery/([^/]*)/([^/]*)/([^/]*)/$ /wp-content/themes/ior/page-galleria.php?n=$1&i=$2&c=$3 [L]
    #RewriteRule ^photos/gallery/([^/]*)/([^/]*)/([^/]*)/$ index.php?pagename=photos/gallery&n=$1&i=$2&c=$3 [L]
Viewing 2 replies - 1 through 2 (of 2 total)
  • Are the #’s present currently in your .htaccess file? # in .htaccess means ignore this line…

    Nope. This is an exceptionally bad idea.

    I know that’s annoying to hear, especially since it doesn’t answer your question..but just trust me. You never want PHP to handle all redirects. It will slow your site down, and with bots on the internet,it would bring it to a halt without something like php-fastcgi.

    Seacoast is right, they’re commented out. If that’s the problem, then you’ll be golden.

    (more info)
    Think of it this way: If you put it in functions.php, then that means it has to load all of wordpress into memory just to do a redirect. This will just kill you. Even if you could get it to work, it wouldn’t work very long.

    Best of luck!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Move rewrite rule to functions.php’ is closed to new replies.