htaccess redirect old links to new domain

前端 未结 2 830
臣服心动
臣服心动 2021-01-28 11:07

I changed my site domain, and want to redirect old urls to new domain

(note: instead of numbers 93, 54 maybe any digit number exists) the old urls are:

h         


        
相关标签:
2条回答
  • 2021-01-28 11:10

    This should work:

    RewriteEngine On
    RewriteRule ^(.*) http://newdomain.com/$1 [R=301]
    

    It will redirect all pages from the old website to the new website.

    0 讨论(0)
  • 2021-01-28 11:21

    If it's just those three you want to redirect, you can do it with an OR in your regex. The below should work.

    RewriteEngine On
    RewriteRule ^/(45|p/93|$)$ http://newdomain.com/$1 [R,L]
    
    0 讨论(0)
提交回复
热议问题