简体   繁体   中英

.htaccess redirect all pages and url from old domain to new domain

to be very honest I have zero knowledge with Regex and .htaccess

somewhere I found this code sample to redirect the user from old domain to new domain and it works fine

RewriteCond %{HTTP_HOST} ^(www\.)?old\.com$ [NC]
RewriteRule ^(.*)$ http://www.new.com/$1 [R=301,L]

But what is the issue here is when I access any page like www.old.com/courses it remains there rather of redirecting it to www.new.com/courses

It is a wordpress site and it has thousand of such sub/internal pages.

确保您所有wordpress规则之前都有这些规则。

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