Support » Fixing WordPress » .htaccess and subdirectories, 403 error

  • Resolved Ciferial

    (@ciferial)


    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
Viewing 3 replies - 1 through 3 (of 3 total)
  • 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

    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!

    Hi Ciferial!

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

    Thanks
    Massam

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘.htaccess and subdirectories, 403 error’ is closed to new replies.