Multiple 301 Redirect For Multiple Pages or URL

后端 未结 2 453
失恋的感觉
失恋的感觉 2020-12-21 13:23

I am redesigning my store and so the old structure has been changed with the new structure. So trying to redirect all old products with the new.

I have more than 20-

2条回答
  •  情书的邮戳
    2020-12-21 13:41

    It is better to use RewriteMap for your requirement. Here is an example how to use it:

    1. Add following line to your httpd.conf file:

      RewriteMap prodMap txt://path/to/prodMap.txt
      
    2. Create a text file as /path/to/prodMap.txt like this:

      somename nicecar
      blabla newpros
      
    3. Add these line in your .htaccess file under DOCUMENT_ROOT:

      Options +FollowSymLinks -MultiViews
      RewriteEngine on
      
      RewriteRule ^store/products/([^/]+)/?$ http://store.domain.com/${prodMap:$1} [L,R=301,NC]
      

提交回复
热议问题