
# BEGIN WordPress
<IfModule mod_rewrite.c>
Options +FollowSymLinks


RewriteEngine on
#========================================================================
# FIRST Handle the http requests first before removing the additional url junk
#========================================================================
#rule for theipi.org to link to main directory
RewriteCond %{HTTP_HOST} ^(www.)?theipi.org$
RewriteCond %{REQUEST_URI} !^/main/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /main/$1
#rule for freepsychotherapybooks.org to link to ebook directory. Its the same as above just with ebook URL and subfolder
RewriteCond %{HTTP_HOST} ^(www.)?freepsychotherapybooks.org$
RewriteCond %{REQUEST_URI} !^/ebook/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /ebook/$1

#==========================================================
# SECOND Remove the additional url junk once the new url is loaded
#==========================================================
#rule for site1 url rewrite to remove /site1foler/index.php from the URL
RewriteCond %{HTTP_HOST} ^(www.)?theipi.org$
RewriteRule ^(/)?$ main/index.php
#rule for ebook url rewrite to remove /ebook/index.php from the URL. Again its the same as above just with the ebook URL and sub folder info.
RewriteCond %{HTTP_HOST} ^(www.)?freepsychotherapybooks.org$
RewriteRule ^(/)?$ ebook/index.php
</IfModule>

# END WordPress