{"id":544258,"date":"2007-03-30T22:46:31","date_gmt":"2007-03-30T22:46:31","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/subdir-symlinks-having-htaccess-authorization-get-404\/"},"modified":"2016-08-18T22:44:24","modified_gmt":"2016-08-18T22:44:24","slug":"subdir-symlinks-having-htaccess-authorization-get-404","status":"closed","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/subdir-symlinks-having-htaccess-authorization-get-404\/","title":{"rendered":"subdir \/ symlinks having htaccess authorization get 404?"},"content":{"rendered":"<p>In <a href=\"https:\/\/wordpress.org\/support\/topic\/112130\">another thread<\/a> i resolved an issue about symbolic links getting eaten by wordpress by adding:<\/p>\n<p><code>RewriteCond %{REQUEST_FILENAME} !-l<\/code><\/p>\n<p>to the existing conditions:<\/p>\n<pre><code>RewriteCond %{REQUEST_FILENAME} !-f\nRewriteCond %{REQUEST_FILENAME} !-d<\/code><\/pre>\n<p>generated for the site root .htaccess by wordpress.<\/p>\n<p>The situation is only halfway resolved, because for regular symbolic links this indeed works, but if the symlink links to a folder that has its own htaccess that employs authentication, the conditional statement fails. <\/p>\n<p>This occurs not only with symlinks, but also with a real subdirectory is protected by htaccess auth. Means that the authentication is making real folders, and thus symbolic links to those folders fail the above rewrite conditions.<\/p>\n<p>Is there a workaround to beat this situation? Obviously quite beyond the scope of just wordpress, this is advanced htaccess voodoo. <\/p>\n<p>here are two examples I&#8217;ve created:<\/p>\n<p>NOTE:  subdir\/ is a real sub directory in the site root<br \/>\n<a href=\"http:\/\/gedanken-experiment.com\/regular-symlink\/\">regular-symlink\/<\/a> links (correctly) to <a href=\"http:\/\/gedanken-experiment.com\/subdir\/regular\/\">subdir\/regular\/<\/a> folder,  and <a href=\"http:\/\/gedanken-experiment.com\/restricted-symlink\/\">restricted-symlink\/<\/a>  links to <a href=\"http:\/\/gedanken-experiment.com\/subdir\/restricted\/\">subdir\/restricted\/<\/a>  folder where i have implemented some .htaccess authentication mechanism.  As you can see with the restricted-symlink\/ as well as the real folder subdir\/restricted\/ it gets eaten by wordpress and spit out by the wp 404 not found page.  This means it must have slipped through the Rewrite Condition failing to show up as a real directory\/link.<\/p>\n<p>Edit:  modified the thread title to correctly represent the thread body and question.<\/p>\n","protected":false},"template":"","class_list":["post-544258","topic","type-topic","status-closed","hentry","topic-tag-authentication","topic-tag-htaccess"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/544258","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/544258\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=544258"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}