Jump to content

301 redirect from .aspx to .php via .htaccess


ederrafo

Recommended Posts

Hi

 

a question. 
aspx if the url has parameters? not work. 
I have this in my .htaccess file: 
 
Redirect 301 /ViewCatalogUI.aspx http://midomain.com/products
Redirect 301 /ViewCatalogUI.aspx?.language=1&.product=1 http://midomain.com/products/product-1
Redirect 301 /ViewCatalogUI.aspx?.language=1&.product=2 http://midomain.com/products/product-2
 
 
thanks for your help

Don't hijack threads.

 

Redirect doesn't work with query strings. You do, in fact, need mod_rewrite (unless you want to do it in ViewCatalogUI.aspx).

RewriteCond %{QUERY_STRING} ^$
RewriteRule /ViewCatalogUI.aspx http://www.example.com/products [L,R=301]

RewriteCond %{QUERY_STRING} (^|&)\.product=(\d+)(&|$)
RewriteRule /ViewCatalogUI.aspx http://www.example.com/products/product-%2 [L,R=301]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.