简体   繁体   中英

Redirection on htaccess, from subdomain

We moved our site from customize CMS to wordpress. It is multi-language website with couple of languages.

Example of page from old site, and how it is on the new site:

  • on the previous CMS the languages was set like that: ru.domain.com/articles/587
  • now, on Wordpress (with WMPL) it will be: domain.com/ru/gelatti-de-marco-2/

There are something like 10 pages that we need to do redirect from the old subdomain to the new subdomain, how we can do it from htaccess file?

Place this rule in your DOCUMENT_ROOT/.htaccess file of ru.domain.com :

RewriteEngine On

RewriteCond %{HTTP_HOST} =ru.domain.com
RewriteRule ^articles/587/?$ http://domain.com/ru/gelatti-de-marco-2/ [L,NC,R=302]

Once you verify it is working fine, replace R=302 to R=301 . Avoid using R=301 (Permanent Redirect) while testing your mod_rewrite rules.

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