# disable users from viewing .htaccess files 
<Files .htaccess>
order allow,deny
deny from all
</Files>

Options +FollowSymLinks

# disable index listings
Options -indexes

ErrorDocument 404 /index.php?p=bad
AddType text/x-vcard .vcf

# ___________________________________________
# rewrite module, for SEF urls
RewriteEngine on
RewriteBase /

# -------------------------------------------------------------------------------------
# redirect dynamic URLS to static for spiders
# -------------------------------------------------------------------------------------

# RewriteCond %{REQUEST_URI} ^.*index\.php$
# RewriteCond %{QUERY_STRING} ^p=([^&]+)$
# RewriteCond %(QUERY_STRING} ^c=([^&]+)$

RewriteCond %{QUERY_STRING} !^trip$
RewriteCond %{QUERY_STRING} ^c\=([^&]+)\&p\=([^&]+)$
RewriteRule ^.*$ /%1/%2.html? [R=301,L]

# ------------------------------------------------------------------------------------
# redirect static URLS to dynamic script for processing
# ------------------------------------------------------------------------------------

# RewriteCond %{QUERY_STRING} ^c\=([^&]+)\&p\=([^&]+)$
# RewriteCond %{REQUEST_URI} ^/(.*)/$
# RewriteRule ^/(.*)/(.*)\.html$ /index.php?trip=1&c=$2&p=$1 [NC,L]

# RewriteCond %{QUERY_STRING} ^p=([^&]+)$
# RewriteRule ^(.*)\.html$ /index.php?trip=1&p=$1 [NC]

# RewriteCond %{REQUEST_URI} !^/(.+)/(.*)\.html$
# RewriteRule ^(.*)\.html$ /index.php?trip=1&p=$1 [NC]

# trailing slash
# RewriteCond %{REQUEST_FILENAME} !^/$
# RewriteRule ^(.+[^/])$ /index.php?c=$1 [R]

RewriteCond %{REQUEST_URI} ^/([^/]+)/([^/]+)/$
RewriteRule ^(.+)/(.+)/$ /index.php?c=$1&sc=$2

RewriteCond %{REQUEST_URI} ^/([^/]+)/$
RewriteRule ^(.+)/$ /index.php?c=$1

RewriteCond %{QUERY_STRING} ^c\=([^&]+)\&p\=([^&]+)$
RewriteRule ^.*$ /%1/%2.html? [R=301,L]

RewriteCond %{REQUEST_URI} ^/([^/]+)/([^/]+)/(.*)\.html$
RewriteRule ^([^/]+)/([^/]+)/(.+)\.html?$ index.php?trip=1&c=$1&sc=$2&p=$3 [NC,L]

RewriteCond %{REQUEST_URI} ^/([^/]+)/(.*)\.html$
RewriteRule ^([^/]+)/(.+)\.html?$ index.php?trip=1&c=$1&p=$2 [NC,L]

# RewriteCond %{REQUEST_URI} !^/([^/]+)/(.*)\.html$
RewriteRule ^(.*)\.html$ /index.php?trip=1&p=$1 [NC]

# RewriteCond %{QUERY_STRING} ^p=([^&]+)$
# RewriteRule ^.*$ %1.html? [R=301,L]

# RewriteRule ^/*index.php - [L]

# RewriteRule ^/*([^/]+)/+([^/]+)(.*)/*$ $3?$1=$2 [L,QSA]
# RewriteRule ^([^/]+)$ index.php?$1 [L,QSA]

RewriteCond %{HTTP_HOST} ^visionpd\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.visionpd\.com$
RewriteRule ^/?$ "http\:\/\/ivestercreative\.com\/" [R=301,L]

RewriteCond %{HTTP_HOST} ^visionpd\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.visionpd\.com$
RewriteRule ^photo\/index\.html$ "http\:\/\/ivestercreative\.com\/photography\/" [R=301,L]

RewriteCond %{HTTP_HOST} ^visionpd\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.visionpd\.com$
RewriteRule ^photo\/$ "http\:\/\/ivestercreative\.com\/photography\/" [R=301,L]

