i am working with post affiliate pro and part of their script allows replication of a website. this is accomplished with a few rules in htaccess, i am having some difficulty converting them to work with nginx.
the htaccess rules are:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/(.*) http://aff.domain.com/scripts/page.php?a_aid=$1&a_bid=126acd72&a_file=$2 [L,P,QSA]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+) http://aff.domain.com/scripts/page.php?a_aid=$1&a_bid=126acd72&a_redir=Y [L,P,QSA]
what should happen is when visiting www.domain.com/AFFID, page.php loads the site with some variables pulled from the affiliate's profile IE, Name, Email etc. it should also stay at www.domain.com/AFFID/pagename will navigation.
i have tried to rewrite the htaccess and tried a couple of converters and this is as close as i can get:
location / {
if (!-e $request_filename){
rewrite ^/([^/]+)/(.*) http://aff.domain.com/scripts/page.php?a_aid=$1&a_bid=126acd72&a_file=$2 redirect;
}
if (!-e $request_filename){
rewrite ^/([^/]+) http://aff.domain.com/scripts/page.php?a_aid=$1&a_bid=126acd72&a_redir=Y redirect;
}
}
the above configuration works but instead of keeping www.domain.com/AFFID it will use the affiliate installation URL like so
aff.domain.com/page.php?a_aid=AFFID&a_bid=126acd72&a_file=contact-us/
it works but the it should maintain the www.domain.com URL. and look like so
www.domain.com/AFFID/contact-us
i have tried adding proxy_pass with no luck
location / {
if (!-e $request_filename){
rewrite ^/([^/]+)/(.*);
proxy_pass http://aff.domain.com/scripts/page.php?a_aid=$1&a_bid=126acd72&a_file=$2 redirect;
}
if (!-e $request_filename){
rewrite ^/([^/]+);
proxy_pass http://aff.domain.com/scripts/page.php?a_aid=$1&a_bid=126acd72&a_redir=Y redirect;
}
}
if it helps, here is a link to the post affiliate pro site explaining how this should work. http://support.qualityunit.com/307164-Site-Replication
Thank you for any direction
Sean
the htaccess rules are:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/(.*) http://aff.domain.com/scripts/page.php?a_aid=$1&a_bid=126acd72&a_file=$2 [L,P,QSA]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+) http://aff.domain.com/scripts/page.php?a_aid=$1&a_bid=126acd72&a_redir=Y [L,P,QSA]
what should happen is when visiting www.domain.com/AFFID, page.php loads the site with some variables pulled from the affiliate's profile IE, Name, Email etc. it should also stay at www.domain.com/AFFID/pagename will navigation.
i have tried to rewrite the htaccess and tried a couple of converters and this is as close as i can get:
location / {
if (!-e $request_filename){
rewrite ^/([^/]+)/(.*) http://aff.domain.com/scripts/page.php?a_aid=$1&a_bid=126acd72&a_file=$2 redirect;
}
if (!-e $request_filename){
rewrite ^/([^/]+) http://aff.domain.com/scripts/page.php?a_aid=$1&a_bid=126acd72&a_redir=Y redirect;
}
}
the above configuration works but instead of keeping www.domain.com/AFFID it will use the affiliate installation URL like so
aff.domain.com/page.php?a_aid=AFFID&a_bid=126acd72&a_file=contact-us/
it works but the it should maintain the www.domain.com URL. and look like so
www.domain.com/AFFID/contact-us
i have tried adding proxy_pass with no luck
location / {
if (!-e $request_filename){
rewrite ^/([^/]+)/(.*);
proxy_pass http://aff.domain.com/scripts/page.php?a_aid=$1&a_bid=126acd72&a_file=$2 redirect;
}
if (!-e $request_filename){
rewrite ^/([^/]+);
proxy_pass http://aff.domain.com/scripts/page.php?a_aid=$1&a_bid=126acd72&a_redir=Y redirect;
}
}
if it helps, here is a link to the post affiliate pro site explaining how this should work. http://support.qualityunit.com/307164-Site-Replication
Thank you for any direction
Sean