Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How do I keep code after redirects in .htaccess?

Discussion in 'General Discussion' started by primerano, Jan 10, 2013.

  1. primerano

    primerano Registered

    Sep 13, 2012
    Likes Received:
    Trophy Points:
    cPanel Access Level:
    Root Administrator
    In order for my redirects to work on a site that has wordpress installed I need to put the redirects before the wordpress htaccess code.

    redirects here then wordpress.
    # 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]

    # END WordPress

    The problem is that as you add new redirects it adds them after this block and they won't work as the wordpress rules will fire 1st.

    Is there a way to make new redirects not come last?

    Or maybe I can include the wordpress rules via a separate file (assuming I can force this include to be the last line).

    Any pointers?


Share This Page