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
Link to comment
Share on other sites

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]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.