mod_rewrite question. Everything matching the rule.

Discussion in 'Apache' started by nriweb, Jun 6, 2008.

  1. #1
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /blog.php [L]
    </IfModule>

    What I did was moved index.php to blog.php
    But for all files .. say test.php which is a test file, it still calls blog.php
    Even for directories which are present, for eg: images, it redirects to blog.php ..

    I though the Conditions ie !-f and !-d should not redirect to blog.php for files which exist.

    thanks.
     
    nriweb, Jun 6, 2008 IP
  2. nriweb

    nriweb Well-Known Member

    Messages:
    422
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    108
    #2
    no replies ?
     
    nriweb, Jun 6, 2008 IP
  3. buldozerceto

    buldozerceto Active Member

    Messages:
    1,137
    Likes Received:
    43
    Best Answers:
    0
    Trophy Points:
    88
    #3
    Are you trying to change the directory index?
    Put this in htacess
    DirectoryIndex blog.php
     
    buldozerceto, Jun 7, 2008 IP
  4. nriweb

    nriweb Well-Known Member

    Messages:
    422
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    108
    #4
    no.

    I had a wordpress blog running at the root.
    But now I am starting something else in addition to the blog on the root.

    So I changed index.php to blog.php in

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /blog.php [L]
    </IfModule>


    I thought !-f and !-d will take care of handling all non wordpress files and dirs. I mean if I have a file called test.html in the root dir then the url domain.com/test.html should show me that file. It does not. It shows me blog.php

    pls help
     
    nriweb, Jun 7, 2008 IP
  5. buldozerceto

    buldozerceto Active Member

    Messages:
    1,137
    Likes Received:
    43
    Best Answers:
    0
    Trophy Points:
    88
    #5
    I think you have mistake in .htaccess code
    Try this one:
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /blog.php [L]
    </IfModule>
     
    buldozerceto, Jun 8, 2008 IP
  6. nriweb

    nriweb Well-Known Member

    Messages:
    422
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    108
    #6
    thanks a lot. I really appreciate the help.
     
    nriweb, Jun 8, 2008 IP