mod_rewrite and .htaccess

Discussion in 'Apache' started by seolion, Nov 7, 2006.

  1. #1
    Hi,

    i have seen that wordpress and other article scripts use .htaccess instructions as follows

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l
    RewriteRule .* index.php [QSA,L]


    How it is different from basic mod-rewrite conditions as explained in the FAQ section by Nintendo ?
     
    seolion, Nov 7, 2006 IP
  2. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #2
    I rarly ever use the

    RewriteCond

    stuff.
     
    Nintendo, Nov 8, 2006 IP
  3. seolion

    seolion Active Member

    Messages:
    1,495
    Likes Received:
    97
    Best Answers:
    0
    Trophy Points:
    90
    #3
    whatever you have explained in FAQ I have understood, but about the above one, how it works I dont have any idea.
     
    seolion, Nov 8, 2006 IP
  4. WhiteHatHacker

    WhiteHatHacker Peon

    Messages:
    21
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Don't know if this is still relevant, but they are conditions which specify only to apply the following directives if they are true.

    The above set of messages simply translate as:

    IF %{REQUEST_FILENAME} is NOT a FILE
    AND IF %{REQUEST_FILENAME} is NOT a DIRECTORY
    AND IF %{REQUEST_FILENAME} is NOT a LINK
    THEN:
    TRY TO APPLY RewriteRule

    %{REQUEST_FILENAME} is a reference to the environment variable REQUEST_FILENAME, which is the actual file which the request is asking for.

    Even more consicely, the above rules say: "if it doesn't exist, just show the user index.php, having sent index.php any queries like ?q=10 ([QSA]), and don't bother applying any more rules ([L])".

    Hope that helps.
     
    WhiteHatHacker, Nov 8, 2006 IP
    seolion likes this.
  5. seolion

    seolion Active Member

    Messages:
    1,495
    Likes Received:
    97
    Best Answers:
    0
    Trophy Points:
    90
    #5
    thank you WhiteHatHacker
     
    seolion, Nov 8, 2006 IP