How to avoid a file to redirect
5 posts
• Page 1 of 1
How to avoid a file to redirect
I want avoid the files under the products, e.g.
RewriteEngine on
RewriteBase /
RewriteMap mapfile txt:mapfile.txt
RewriteMap revmapfile txt:revmapfile.txt
RewriteCond %{QUERY_STRING} (.+) [NC]
RewriteRule ^(.*)products/projectinfopage.aspx$ http://www.abc.com/$1products/${mapfile:%1}? [NC,R=301,L]
RewriteRule ^(.*)products/(.*)(?!.*(?:\.)).* $1products/productinfopage.aspx?${revmapfile:$2} [NC,L]
But the products/find-a-product.aspx, products/allitems.aspx aslo will redirect.
can I exlcude the "." for Links to avoid the files to redirect?
RewriteEngine on
RewriteBase /
RewriteMap mapfile txt:mapfile.txt
RewriteMap revmapfile txt:revmapfile.txt
RewriteCond %{QUERY_STRING} (.+) [NC]
RewriteRule ^(.*)products/projectinfopage.aspx$ http://www.abc.com/$1products/${mapfile:%1}? [NC,R=301,L]
RewriteRule ^(.*)products/(.*)(?!.*(?:\.)).* $1products/productinfopage.aspx?${revmapfile:$2} [NC,L]
But the products/find-a-product.aspx, products/allitems.aspx aslo will redirect.
can I exlcude the "." for Links to avoid the files to redirect?
Re: How to avoid a file to redirect
and btw,How can just match a querystring parameter. eg.
http://www.abc.com/products/product.asp ... =1&type=xy
SEO to http://www.abc.com/products/prodcutname?type=xy
the revert to
http:// http://www.abc.com/products/product.asp ... =1&type=xy
RewriteEngine on
RewriteBase /
RewriteMap mapfile txt:mapfile.txt
RewriteMap revmapfile txt:revmapfile.txt
RewriteCond %{QUERY_STRING} (.+) [NC]
RewriteRule ^(.*)products/product.aspx$ http://www.abc.com/$1products/${mapfile:%1}? [NC,R=301,L]
RewriteRule ^(.*)products/(.*)(?!.*(?:\.)).* $1products/productinfopage.aspx?${revmapfile:$2} [NC,,QSA,L]
http://www.abc.com/products/product.asp ... =1&type=xy
SEO to http://www.abc.com/products/prodcutname?type=xy
the revert to
http:// http://www.abc.com/products/product.asp ... =1&type=xy
RewriteEngine on
RewriteBase /
RewriteMap mapfile txt:mapfile.txt
RewriteMap revmapfile txt:revmapfile.txt
RewriteCond %{QUERY_STRING} (.+) [NC]
RewriteRule ^(.*)products/product.aspx$ http://www.abc.com/$1products/${mapfile:%1}? [NC,R=301,L]
RewriteRule ^(.*)products/(.*)(?!.*(?:\.)).* $1products/productinfopage.aspx?${revmapfile:$2} [NC,,QSA,L]
Re: How to avoid a file to redirect
Hello,
To exclude ".", please use the following structure [^.].
I've also added you the part to match the "type" parameter which you want to leave:
RewriteEngine on
RewriteBase /
RewriteMap mapfile txt:mapfile.txt [NC]
RewriteMap revmapfile txt:revmapfile.txt [NC]
RewriteCond %{QUERY_STRING} ^(.+(type=.+))$ [NC]
RewriteRule ^(.*)products/product\.aspx$ http://www.abc.com/$1products/${mapfile:%1}\?%2 [NC,R=301,L]
RewriteRule ^(.*)products/([^.]*)$ $1products/product.aspx?${revmapfile:$2} [NC,L]
To exclude ".", please use the following structure [^.].
I've also added you the part to match the "type" parameter which you want to leave:
RewriteEngine on
RewriteBase /
RewriteMap mapfile txt:mapfile.txt [NC]
RewriteMap revmapfile txt:revmapfile.txt [NC]
RewriteCond %{QUERY_STRING} ^(.+(type=.+))$ [NC]
RewriteRule ^(.*)products/product\.aspx$ http://www.abc.com/$1products/${mapfile:%1}\?%2 [NC,R=301,L]
RewriteRule ^(.*)products/([^.]*)$ $1products/product.aspx?${revmapfile:$2} [NC,L]
Re: How to avoid a file to redirect
if the URL don't include the paramter "type", can I remove the last "?" from the SEO url?
Thanks,
Gan
Thanks,
Gan
Re: How to avoid a file to redirect
Hello, Gan
>if the URL don't include the paramter "type", can I remove the last "?" from the SEO url?
Yes, please fix the rules like this:
RewriteEngine on
RewriteBase /
RewriteMap mapfile txt:mapfile.txt [NC]
RewriteMap revmapfile txt:revmapfile.txt [NC]
RewriteCond %{QUERY_STRING} ^(.+?(type=.+)?)$ [NC]
RewriteRule ^(.*)products/product\.aspx$ http://www.abc.com/$1products/${mapfile:%1}(?%2\?%2) [NC,R=301,L]
RewriteRule ^(.*)products/([^.]*)$ $1products/product.aspx?${revmapfile:$2} [NC,L]
>if the URL don't include the paramter "type", can I remove the last "?" from the SEO url?
Yes, please fix the rules like this:
RewriteEngine on
RewriteBase /
RewriteMap mapfile txt:mapfile.txt [NC]
RewriteMap revmapfile txt:revmapfile.txt [NC]
RewriteCond %{QUERY_STRING} ^(.+?(type=.+)?)$ [NC]
RewriteRule ^(.*)products/product\.aspx$ http://www.abc.com/$1products/${mapfile:%1}(?%2\?%2) [NC,R=301,L]
RewriteRule ^(.*)products/([^.]*)$ $1products/product.aspx?${revmapfile:$2} [NC,L]
5 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 21 guests