WordPress.org

Forums

permalinks exclusion using .htaccess mod_rewrite (2 posts)

  1. masaka
    Member
    Posted 5 years ago #

    I did a quick search of the forums, but it seems that they're either saying it's no problem, or they haven't been answered. If it's a problem with my server, please let me know.

    I've installed wordpress in the main root folder, and then another software as a directory underneath it:

    wordpress is at: /public_html , appears as http://www.mydomain.com/
    new script is at: /public_html/myscript , appears as http://www.mydomain.com/myscript

    However, since I'm using permalinks, WordPress rewrites my urls to the wordpress index.php instead, and does not allow me to access myscript at all. Instead, it gives me a 404 error based on my wordpress template. This is appears to be the work of mod_rewrite and the .htaccess file.

    Here is my original .htaccess:

    # -FrontPage-
    
    IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
    
    <Limit GET POST>
    order deny,allow
    deny from all
    allow from all
    </Limit>
    <Limit PUT DELETE>
    order deny,allow
    deny from all
    </Limit>
    
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress

    I understand that RewriteCond %{REQUEST_FILENAME} !-f and RewriteCond %{REQUEST_FILENAME} !-d means, "if the file or the directory exists, then do not forward it to index.php (ie. wordpress)", but if this were true, then i should have no trouble accessing /myscript/ or /myscript/index.php

    Here is my attempt to write an exclusion:

    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule ^ %{REQUEST_FILENAME} [L]
    
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteCond %{REQUEST_FILENAME}/index.php -f
    RewriteRule ^ %{REQUEST_FILENAME}/index.php [L]

    I've placed this before the #BEGIN WORDPRESS, but to no avail.

    Here is my second attempt to write an exclusion:

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

    Also is not working. Is there something I'm missing?

    Thank you all for your time and patience.

  2. DrDaveHPP
    Member
    Posted 4 years ago #

    I'm getting the same problem - did you ever find out a solution? If so, I'm sure you'd make a lot of people very happy if you shared it with us.

    The infuriating thing is that I've got another domain on the same server where it all works fine - and I can't work out where the difference lies.

Topic Closed

This topic has been closed to new replies.

About this Topic