{"id":5398720,"date":"2014-10-17T16:28:19","date_gmt":"2014-10-17T16:28:19","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/multisites-htaccess-interferes-with-cgi-bin\/"},"modified":"2016-08-22T03:33:53","modified_gmt":"2016-08-22T03:33:53","slug":"multisites-htaccess-interferes-with-cgi-bin","status":"closed","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/multisites-htaccess-interferes-with-cgi-bin\/","title":{"rendered":"Multisites .htaccess interferes with cgi-bin"},"content":{"rendered":"<p>I&#8217;m currently setting up a WordPress multisite installation for my company and I&#8217;ve run into an issue.<\/p>\n<p>The set up is that the multisite runs out of a subdirectory (\/wp) but appears to be at the root of the site. It&#8217;s using subdirectories for each site in the network (ex. domain.com\/news).<\/p>\n<p>I&#8217;ve followed the wordpress.org guides and have gotten the install running just fine. The problem is that I&#8217;ve found out that the mod_rewrites I needed to add for WordPress to work cause any .pl scripts in the \/cgi-bin folder to stop working (Error 403). I know they&#8217;re super old; I&#8217;d like to switch them to much better form scripts but that&#8217;s a battle for another time. The cgi-bin scripts are very important for the business so I can&#8217;t go forward with any more WordPress development until I find a solution.<\/p>\n<p>What solutions I have found are for non-multisite WordPress and don&#8217;t seem to work for my setup. I&#8217;m not very familiar with .htaccess and mod_rewrite so I&#8217;m not sure what I should be doing.<\/p>\n<p>Here&#8217;s the code I need to add to the .htaccess located at the root of the site:<\/p>\n<pre><code>RewriteEngine On\nRewriteBase \/\nRewriteRule ^index\\.php$ - [L]\n\n# add a trailing slash to \/wp-admin\nRewriteRule ^([_0-9a-zA-Z-]+\/)?wp-admin$ $1wp-admin\/ [R=301,L]\n\nRewriteCond %{REQUEST_FILENAME} -f [OR]\nRewriteCond %{REQUEST_FILENAME} -d\nRewriteRule ^ - [L]\nRewriteRule ^([_0-9a-zA-Z-]+\/)?(wp-(content|admin|includes).*) wp\/$2 [L]\nRewriteRule ^([_0-9a-zA-Z-]+\/)?(.*\\.php)$ wp\/$2 [L]\nRewriteRule . index.php [L]<\/code><\/pre>\n<p>I think I&#8217;m suppose to add a rule like this one to get it to ignore \/cgi-bin:<\/p>\n<p><code>RewriteCond %{REQUEST_URI} !^\/cgi-bin\/<\/code><\/p>\n<p>But either that&#8217;s the wrong rule or I&#8217;m putting it in the wrong place. Can anyone help me figure this out?<\/p>\n","protected":false},"template":"","class_list":["post-5398720","topic","type-topic","status-closed","hentry","topic-tag-htaccess","topic-tag-multisite","topic-tag-subdirectories"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/5398720","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\/5398720\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=5398720"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}