.htaccess 301 Redirect from Old URL structure to New URL structure

前端 未结 2 1365
轻奢々
轻奢々 2021-01-28 06:38

I\'m trying to redirect a user to a new URL structure.

Here\'s the old URL structure:

http://www.mywebsite.com/pants/pant-item-1234

Here\'s the new URL s

相关标签:
2条回答
  • 2021-01-28 07:16

    Just use Rewrite URL... I wouldn't redirect unless you're not using mywebsite.com as a landing page at all. http://httpd.apache.org/docs/2.0/misc/rewriteguide.html You will need to make sure you have your rewrite engine on.

    0 讨论(0)
  • 2021-01-28 07:28
    RewriteRule ^pants/(.+)$ /catalog/pants/$1 [R=301,L]
    

    Or, if pants can actually be something else

    RewriteRule ^([^/]+)/(.+)$ /catalog/$1/$2 [R=301,L]
    

    I haven't tested it, so I'm not sure it will work, sorry

    0 讨论(0)
提交回复
热议问题