I have several hosted clients and several subdomain clients, and I'd like to write .htaccess or php.ini rules to allow each of these sites, including my root site to have access to a common folder (/home/usr/public_html/public_scripts/) public that the clients (/home/usr/public_html/subdomains/client/) or (/home/usr/public_html/hosts/clients/) cannot see in ftp, but the root site can:
/home/usr
|--/public_html
|--/public_scripts/
|
|--/hosts
| |--/client
| |--/subdomains
|
|--/subdomains
|--client
So that I can use this folder from:
www.mydomain.com/public_scripts/
subdomain.mydomain.com/public_scripts/
www.theirdomain.com/public_scripts/
subdomain.theirdomain.com/public_scripts/
I've tried:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^common/(.*)$ /home/usr/public_html/public_scripts/$1 [QSA]
</IfModule>
But this did not work. It simply redirects to /index.php
Shared hosting, so I do not have access to the httpd-conf file. I do have access to php.ini
it is matching correctly when I turn the WP rules off. I have both subdomain and domain mapping in my site, but I'm not sure if I need wp both sections or if I can combine all three into one rewrite rule.
Edit: Here's the rewrite rules I'm using, now that I realized I'm on a wordpress HTACCESS:
<IfModule mod_rewrite.c>
# BEGIN Wordpress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]
# END Wordpress
</IfModule>
<IfModule mod_rewrite.c>
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^common/(.*)$ /home/usr/public_html/public_scripts/$1 [QSA]
</IfModule>
AddHandler application/x-apple-aspen-config .mobileconfig
But this did not work. It simply redirects to /index.php
Shared hosting, so I do not have access to the httpd-conf file. I do have access to php.ini
It is matching correctly when I turn the WP rules off. I have both subdomain and domain mapping in my site, but I'm not sure if I need wp both sections or if I can combine all three into one rewrite rule.
Here's the "working" htaccess. Some day I'll have to organize these when I have more time:
<IfModule mod_rewrite.c>
# BEGIN Wordpress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]
# END Wordpress
</IfModule>
<IfModule mod_rewrite.c>
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# END WordPress
RewriteRule ^common/(.*)$ /home/usr/public_html/public_scripts/$1 [QSA]
# BEGIN WORDPRESS
RewriteRule . /index.php [L]
# END WORDPRESS
</IfModule>
AddHandler application/x-apple-aspen-config .mobileconfig