Is there an order to placing commands in .htaccess file?

Discussion in 'Apache' started by gregory65, Apr 30, 2021.

  1. #1
    I have to keep the below block at the bottom of my htaccess file or other commands won't work. Why? I didn't think there was any order to commands in the Apache file. Is that right?
    # BEGIN WordPress
    #NEEDS TO BE AT END OF FILE OR HIDE DEBUG FILE CODE DOESN'T WORK
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]

    # uploaded files
    RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule . index.php [L]
    # END WordPress
     
    gregory65, Apr 30, 2021 IP
  2. qwikad.com

    qwikad.com Illustrious Member Affiliate Manager

    Messages:
    7,263
    Likes Received:
    1,693
    Best Answers:
    31
    Trophy Points:
    475
    #2
    RewriteEngine On and RewriteBase / should be placed just once at the top of the .htaccess file. Don't use them again and again.
     
    qwikad.com, Apr 30, 2021 IP
  3. gregory65

    gregory65 Greenhorn

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #3
    Thank you for the reply. I moved the block to file top and commented out the multiple RewriteEngine On. I had only one RewriteBase / which was in the block. Doing this exposed the debug.log
     
    gregory65, Apr 30, 2021 IP