WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] .htaccess and subdirectories, 403 error (4 posts)

  1. Ciferial
    Member
    Posted 7 years ago #

    I am using permalinks like example.com/post/is/here/. I have a page called "examples" (address is example.com/site/examples/).

    I would like to put images to the directory example.com/site/examples/. However, if I create a folder example.com/site/examples/, the WP page /examples/ stops working and gives a 403 error.

    What should I do to get this thing working? It would be important to have the page at the address example.com/site/example/ and its images etc. like example.com/site/examples/image.png. Now it seems that I can't use the WP page and the "real" directory at the same time.

    Here is my .htaccess:

    RewriteEngine On
    RewriteBase /site/
    
    RewriteCond %{HTTP_HOST} ^shinatrya\.net
    RewriteRule ^(.*)$ http://www.example.net/site/$1 [L,R]
    
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /site/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /site/index.php [L]
    </IfModule>
    
    # END WordPress
  2. AskApache
    Member
    Posted 7 years ago #

    Change your .htaccess to:

    Options -Indexes
    DirectoryIndex index.php
    
    RewriteEngine On
    RewriteBase /site/
    
    RewriteCond %{HTTP_HOST} ^shinatrya\.net
    RewriteRule ^(.*)$ http://www.example.net/site/$1 [L,R]
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /site/index.php [L]

    That should work (im confused about the first rewritecond+rule though..) htaccess help forum

  3. Ciferial
    Member
    Posted 7 years ago #

    I know my .htaccess looks a bit odd. I had a long conversation about this with my host. For some reason the only way to avoid internal server error was to put those "RewriteEngine On" and "RewriteBase /site/" lines twice in the file, first to the first lines and then again when the wordpress rules begin. If it isn't in both places, we'll have an internal server error... Don't know why.

    Anyway, problem resolved. Thank you!

  4. massam
    Member
    Posted 6 years ago #

    Hi Ciferial!

    I am having the same problem as you were having.
    Can you please guide me on this?

    Thanks
    Massam

Topic Closed

This topic has been closed to new replies.

About this Topic