301 redirect puzzle
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
I have a bit of a 301 puzzle here that I can't quite solve, and maybe someone can help me out.
I have 3 pages:
page 1= /merchant.php?i=1
page 2= /merchant.php?i=1&j=2
page 3= /merchant.php?=1&j=2
I want to us a combination of url-rewriting and 301 redirects so they so a request to the old page url's are forwarded to:
page 1= /merchantname
page 2= /merchantnameproductname1
page 3= /merchantnameproductname2
and when these new url's are reached they actually are generated behind the scenes by the old urls.
Now I thought I had it with the following code in my Apache config:
RewriteRule ^/merchantnameproductname2 /merchant\.php\?i\=1\&j\=2 [PT,QSA,NS,NE]
RewriteCond %{REQUEST_URI} ^(.*)merchant\.php(.*)$
RewriteCond %{QUERY_STRING} ^i\=1\&j\=2$
RewriteRule ^(.*)$ /merchantnameproductname2? [R=301,L]
RewriteRule ^/merchantnameproductname1 /merchant\.php\?i\=1\&j\=1 [PT,QSA,NS,NE]
RewriteCond %{REQUEST_URI} ^(.*)merchant\.php(.*)$
RewriteCond %{QUERY_STRING} ^i\=1\&j\=1$
RewriteRule ^(.*)$ /merchantnameproductname1? [R=301,L]
RewriteRule ^/merchantname /merchant\.php\?i\=66 [PT,QSA,NS,NE]
RewriteCond %{REQUEST_URI} ^(.*)merchant\.php(.*)$
RewriteCond %{QUERY_STRING} ^i\=1$
RewriteRule ^(.*)$ /merchantname? [R=301,L]
Now what happens is that the rewrite and 301 redirect works for page1,
but page2 and page3 the 301 works and I get directed to the correct new
page url, but the underlying rewrite always creates the content for
page2, never page3
I am a bit stuck.. can anyone see the flaw?
Thanks.
[Index of Archives]
[Open SSH Users]
[Linux ACPI]
[Linux Kernel]
[Linux Laptop]
[Kernel Newbies]
[Security]
[Netfilter]
[Bugtraq]
[Squid]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Samba]
[Video 4 Linux]
[Device Mapper]