Scot's Scripts FAQs and Module Support

If you don't find the answers here contact us.
Documentation and support for our Miva modules is found here. If you can't find the answer you're looking for contact us and we'll add the information.

Scot's 301 Redirect & .htaccess Utility / How to Redirect Non-SEO/Non-Permalink URLs

How to Redirect Non-SEO/Non-Permalink URLs

Regular 301 redirects work great for SEO style URLs, also known as short links or permalinks. This means URLs with no parameters like this one:

merchant.mvc?screen=PROD&product_code=p123

These URLs need something extra, but with the module it's easy to edit your .htaccess file and add the entries manually by using the examples below .

Note: all of the examples here must be added to the .htaccess file after the line with RewriteEngine On. If your .htaccess file does not have this line, add it above any redirect code you put in.

Example 1: Forward a specific product code to another product code using old style URLs.

Old product code: P1234

New product code: P1234_NEW

Add an entry to your .htaccess file like this:

RewriteCond %{QUERY_STRING} &Product_Code=P1234$ [NC]
RewriteRule merchant /mm5/merchant.mvc?Screen=PROD&Product_Code=P1234_NEW
[L,R=301]

Here we look for the product_code in the QUERY_STRING, everything after the ? symbol on the URL, and if it matches then we forward and exit the .htaccess file. You can have as many of these as you want.

Example 2: Forward one category (CAT1234) to another (CAT1234_NEW), old style URLs.

RewriteCond %{QUERY_STRING} &Category_Code=CAT1234 [NC]
RewriteRule merchant
/mm5/merchant.mvc?Screen=CTGY&Category_Code=CAT1234_NEW [L,R=301]

Example 3: Forward an HTML file to old style Miva Merchant URL

Redirect 301 /mm5/4.22/catalog_P1234.html /mm5/merchant.mvc?Screen=PROD&Product_Code=P1234
Example 4: Forward an old style parameter URL to a new style permalink

If you have old miva merchant parameter style URLs and some equivalent new style permalink URLs, it's quite easy to redirect them using the method below. Note that the redirected URL may not be the same as what you have set in your store, but you get the idea.

RewriteCond %{QUERY_STRING} product_code=P1234
RewriteRule ^ /product/some_product.html? [R=301,L]
updated April 03, 2017