WordPress.org

Ready to get started?Download WordPress

Forums

htaccess issue. (16 posts)

  1. Shelby DeNike
    Member
    Posted 8 years ago #

    So here is the setup. I have wordpress installed in the root public_html/ directory. I am making use of permalinks that are much like sitename.com/archive/post/date/ etc... Anyways in the public_html/ directory I also have a "catalog/" directory which in there includes and install of OSCommerece. All works fine except for when i try to load sitename.com/catalog/admin.php, this returns the default WordPress 404 Error page. This sucks because with out access to that file which IS there I cant admin the shopping cart software. I have removed the .htaccess from public_html/ and all works frin... except that all wordpress links are now sitename.com/?p=1 etc. Is there a way to edit the htaccess to not include the catalog directory? I am not all that good with mod_rewrite and making use of the .htaccess, thanks.

  2. maerk
    Member
    Posted 8 years ago #

    Could you post the entire contents of the .htaccess?

  3. Samuel Wood (Otto)
    Tech Ninja
    Posted 8 years ago #

    You probably need to add this to your .htaccess:
    RewriteCond %{REQUEST_URI} !^/catalog/

    But post the whole thing so everybody can be sure.

  4. Shelby DeNike
    Member
    Posted 8 years ago #

    Its just the default .htaccess file that WordPress Creates. I will post it if required but....

  5. Shelby DeNike
    Member
    Posted 8 years ago #

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

    # END WordPress

  6. Shelby DeNike
    Member
    Posted 8 years ago #

    Otto, I tried to add that line ... and no go. Anyone else have an idea on how to make the main htaccess ignore anything in the catalog/ directory, more importantly the catalog/admin/ directory.

  7. Samuel Wood (Otto)
    Tech Ninja
    Posted 8 years ago #

    Actually, with those lines, you shouldn't be going to wordpress anyway. The first RewriteCond checks that the URL isn't referring to an existing file, the second checks that it's not referring to an existing directory. So if the catalog directory exists and you reference it in the URL, then it should not redirect to index.php and wordpress should not get involved.

    Are we sure that rewriting is working in the first place here? Do your permalinks work normally? How about permissions on the directory and files? Are they correct? How about capitalization? These things are case sensitive.

  8. Shelby DeNike
    Member
    Posted 8 years ago #

    This is the default .htaccess created by WordPress 2.0. I have not made any adjustments to the settings of the .htaccess. the catalog/ directory works just fine and so do all the files in it. only problem is when you try to access catalog/admin/ then it gives you the default WordPress Main page not the 404 like I thought before. The permalinks are working just fine its jsut that it for some reason messes up the catalog/admin/ directory. If I remove the .htaccess then everything works just fine, except that the urls look horrible since they are not /page/ they are instead /?p=123 etc....

  9. maerk
    Member
    Posted 8 years ago #

    Where did you put RewriteCond %{REQUEST_URI} !^/catalog/?

    If it was me, I'd try it here:

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

    # END WordPress

    Sorry, don't know how much you know about .htaccess ;)

  10. Shelby DeNike
    Member
    Posted 8 years ago #

    maerk, that is exactly where I put it and still no go. when I goto the catalog/admin/ directory it loads themain wordpress page.... any other ideas? And yeah when it comes to htaccess I am a big newb.

  11. syncbox
    Member
    Posted 8 years ago #

    Be sure you put it before any other rules in .htaccess

  12. maerk
    Member
    Posted 8 years ago #

    Try this:

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

    # END WordPress

    The downside here is that any URI with the string catalog won't be rewritten, but it's worth a shot, even if only for debugging issues.

  13. Shelby DeNike
    Member
    Posted 8 years ago #

    maerk that worked. Thanks!

  14. maerk
    Member
    Posted 8 years ago #

    Excellent! But you should be aware that any URL containing the string catalog won't be rewritten. So if you have a post with, say, "Take a look at this catalog" as the title, you'll get a not found error.

    This might be a better shot to avoid that problem:

    RewriteCond %{REQUEST_URI} !^catalog/?$

    But if not, change it back and just avoid the word "catalog" (or any word containing "catalog") in anything that might generate a URL -- post title, category name, etc.

  15. mangia
    Member
    Posted 7 years ago #

    I have one problem with htaccess. I made file and enter only this inside:
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ./index.php [L]
    </IfModule>
    I uploaded it to the server in ASCII mod to my www dir. It is root dir for website and indeh.php is in that dir. , but I cant go to to my site. It back me 403 forbidden error. Any idea? I'm using only wp 2.x version.
    When I erase .htaccess file it works OK but links are with ? and numbers

  16. Mactory
    Member
    Posted 7 years ago #

    Since this didn't work for me either:
    RewriteCond %{REQUEST_URI} !^catalog/?$
    but this did:
    RewriteCond %{REQUEST_URI} !^.*catalog.*$

    I just tried joining them like this:
    RewriteCond %{REQUEST_URI} !^.*/catalog/.*$
    and it actually worked for me. I never did anythig with this .htaccess stuff before, but I think it works for me now. Only links with '/catalog/' in it will be excluded, so the ones with 'catalog' in the title should be fine!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.