Forums

RewriteRule in .htaccess (4 posts)

  1. Erikku
    Member
    Posted 1 year ago #

    Hi,

    I read the Apache documentation on the rewrite_mod and I am trying to figure out what the RewriteRules in the .htaccess file for multi-domain do exactly.

    Here is the code:

    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]

    Could you tell me where I get it wrong?

    RewriteRule ^index\.php$ - [L]
    To my understanding it does not do anything, the '-' making the matched string left as it is, and the [L] making it the last Rewrite rule processed.

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]

    I do not understand what the "^ - [L]" achieves here
    Same thing for:
    RewriteRule . index.php [L]

    Thank you.

  2. Andrea_r
    team pirate
    Posted 1 year ago #

    If you're copy-pasting the rules that are provided (in the Network admin area) then it should work - if the server itself is set up properly.

    no knowledge or understanding of rewrite rules is required.

  3. Erikku
    Member
    Posted 1 year ago #

    I am not saying it does not work. I am asking what it does.

  4. RewriteRule ^index\.php$ - [L]

    That basically tells your site to HIDE index.php from view :) Otherwise your URLs would be domain.com/index.php/YYYY/MM/DD/Postname

Topic Closed

This topic has been closed to new replies.

About this Topic