I've learned just a slight bit with WordPress Rewrite API -- just enough to add another rewrite rule for a plugin. The plugin works if installed in the root, but I'm finding that if one installs WordPress in a subdir, then I need to do the following changes to the .htaccess file. I'd like to know how to automate these changes if possible. As well, there's a second problem. If one goes to the Permalinks Settings in WordPress, my custom changes get overwritten (except for my special rule that uses WP Rewrite API). So, I need something that uses WordPress Rewrite API so that they don't get overwritten.
Original .htaccess file
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /mysubdir/
RewriteRule ^index\.php$ - [L]
# my special WP Rewrite API line
RewriteRule ^special(.*)$ /mysubdir/wp-content/plugins/special/app/$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /mysubdir/index.php [L]
</IfModule>
# END WordPress
Changes I Made To Make Plugin Work in a Subdir
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteBase /mysubdir/
RewriteRule ^index\.php$ - [L]
# my special WP Rewrite API line
RewriteRule ^special(.*)$ /mysubdir/wp-content/plugins/special/app/$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule . /mysubdir/index.php [L]
RewriteRule . index.php [L]
</IfModule>
# END WordPress