Announcement

Collapse
No announcement yet.

.htaccess Redirect Long Miva URLs to Short SEO URLs - Without changing the prod codes

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    .htaccess Redirect Long Miva URLs to Short SEO URLs - Without changing the prod codes

    I need a redirect that will redirect a long style url to short style url.

    EX:
    http://www.domain.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=H&Category_Cod e=AMI_H2
    >
    http://www.domain.com/c/AMI_H2.html

    This redirect works if you change the CTGY or PROD code, but other wise it will go into a redirect loop:
    Code:
    RewriteCond %{QUERY_STRING} Category_Code=AMI_H2& [NC,OR]
    RewriteCond %{QUERY_STRING} Category_Code=AMI_H2$ [NC]
    RewriteRule ^(.*)$ http://www.domain.com/c/AMI_H2.html? [L,R=301]
    This fixes the redirect loop but makes pagination redirect you to the shor category page:
    Code:
    RewriteCond %{REQUEST_URI} !^/c/AMI_H2.html
    RewriteCond %{QUERY_STRING} ^Category_Code=AMI_H2(.*)$ [NC]
    RewriteRule ^(.*)$ http://www.hummerpartsclub.com/c/AMI_H2.html? [L,R=301]
    So I was thinking something like this might work, but I cant get it to function properly:
    Code:
    RewriteCond %{REQUEST_URI} !^/c/AMI_H2.html$
    RewriteCond %{HTTP_REFERER} !^domain\.com$ 
    RewriteCond %{QUERY_STRING} Category_Code=AMI_H2 [NC]
    RewriteRule ^(.*)$ http://www.domain.com/c/AMI_H2.html? [L,R=301]
    Is there any validity to that Idea? I am thinking if your store is the referrer then it will stop the redirect from occurring. Because in this case the only time someone would get to these links would be a bookmark, or through pagination.

    Any help with this would be greatly appreciated!
    Calvin Nelson
    Director of Web Development
    2C Development Group

    #2
    Re: .htaccess Redirect Long Miva URLs to Short SEO URLs - Without changing the prod c

    Try this:

    Code:
    RewriteCond %{QUERY_STRING} ^Screen=CTGY&Store_Code=H&Category_Code=(.*)$
    RewriteRule ^(.*)$ http://www.domain.com/c/%1.html? [R=301,L]
    Brennan Heyde
    VP Product
    Miva, Inc.
    [email protected]
    https://www.miva.com

    Comment


      #3
      Re: .htaccess Redirect Long Miva URLs to Short SEO URLs - Without changing the prod c

      That worked perfectly! Thank you!
      Calvin Nelson
      Director of Web Development
      2C Development Group

      Comment

      Working...
      X