Welcome! Log In Create A New Profile

Advanced

assistance with converting some htaccess rules using [P] mod_proxy

Posted by seancon1 
assistance with converting some htaccess rules using [P] mod_proxy
August 30, 2013 03:19PM
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
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 157
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready