WordPress.org

Ready to get started?Download WordPress

Forums

mod_rewrite htaccess MYSTERY... (5 posts)

  1. popart
    Member
    Posted 6 years ago #

    I'm hoping somebody with a better understanding of mod_rewrite may be able to help me figure out what is going on with my "Pretty Permalinks". (I have wordpress installed in a directory "wordpress" instead of root.)

    I've followed many different threads trying to fix it. I changed my .htaccess file to:

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

    But, it still wasn't working. So I tried commenting out the <IfModule lines like so:

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

    And now "Pretty Permalinks" are working on my site. Can anyone explain to me why taking out the <IfModule lines fixed the problem?? I'd just like to understand.

    Thanks.

  2. whooami
    Member
    Posted 6 years ago #

    it shouldnt make any difference.

    what you commented out just wraps those bits in a check to see if mod_rewrite is available. The wrapping prevents an error, IF it is not.

    If someone, say for instance, tried to use your example on a server that didnt have mod_rewrite available, they would get a 500 error.

    Both Apache 1 and 2 should work with that wrapper, just fine. Why it doesnt for you, I dont know.

  3. askapache
    Member
    Posted 5 years ago #

    And now "Pretty Permalinks" are working on my site. Can anyone explain to me why taking out the <IfModule lines fixed the problem?? I'd just like to understand.

    That is awful weird. whooami is right, if you didn't have mod_rewrite and you removed the IfModule lines, it would have resulted in a 500 error.

    What version of Apache, what type of operating system? Where is the .htaccess file at relative to your domains root? ie is it in /wordpress/.htaccess or /.htaccess?

    What does the AskApache RewriteRules Viewer tell you?

  4. jeremy@planhq.com
    Member
    Posted 5 years ago #

    Well to add to the mystery, I'm encountering what looks like the same thing, except mine's not working. commented out or not.

    I'm positive that mod_rewrite is enabled,
    the askapache rewriterules viewer is just confirming what I thought:
    > Permalink: /%postname%/
    > Writable .htaccess file found
    > mod_rewrite found
    > Not using pathinfo style index permalinks
    > Using mod_rewrite permalinks

    I've tried various combinations of the default htaccess file and the following:

    # BEGIN WordPress
    #<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /var/public_html/makeithappen/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /var/public_html/makeithappen/index.php [L]
    #</IfModule>
    
    # END WordPress

    where /var/public_html/makeithappen/ is the wp install.
    any ideas?

  5. jeremy@planhq.com
    Member
    Posted 5 years ago #

    Ah, forgot to mention, the problem is getting a 404 following the permalinks.

Topic Closed

This topic has been closed to new replies.

About this Topic