简体   繁体   中英

Redirect a URL to Another Domain

I have a thousand URL in my old domain. I want to make a new domain and redirect all url from old domain to new domain.

For example my old domain is http://www.domain1.web.id/ my new domain is http://www.domain2.com/ .

And for example url a content from my old domain is http://www.domain1.web.id/itazurana-kiss-the-movie-propose/ and I want to redirect that content url to my new domain.

so, url will be like this in my new domain http://www.domain2.com/itazurana-kiss-the-movie-propose/ .

by the way I am using Wordpress.

what I have to do to redirect all my old url to a new url.

You can achieve this by adding rewrite rule in your .htaccess file. Open your .htaccess file and paste the following code:

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{HTTP_HOST} ^domain1.web.id$ [OR]
  RewriteCond %{HTTP_HOST} ^www.domain1.web.id$
  RewriteRule (.*)$ http://www.domain2.com/$1 [R=301,L]
</IfModule>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM