![](/img/trans.png)
[英]Wordpress > Redirect 301 from domain A to domain B with the same slug
[英]Redirect 301 with wordpress articles from a domain to another
我的客戶將他的wordpress網站更改為一個新域。 我嘗試使用htaccess動態地重定向301文章,但是它不起作用。
文章的URL格式為:/%year%/%monthnum%/%day%/%postname%/
我把它放在htaccess中,但是不起作用:
redirect 301 /([0-9]*)/([0-9]*)/([0-9]*)/(.*)/ http://www.newdomain.com/$1/$2/$3/$4/
你能幫助我嗎 ? 謝謝
編輯:這是我實際的.htaccess:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteRule ^(\d+)/(\d+)/(\d+)/([\w\-]+)/?$ http://www.newdomain.com/$1/$2/$3/$4/ [R=302,NC,L]
您可以為此使用mod_rewrite:
RewriteEngine On
RewriteRule ^(\d+)/(\d+)/(\d+)/([\w\-]+)/?$ http://www.newdomain.com/$1/$2/$3/$4/ [R=302,NC,L]
如果您對重定向感到滿意,並且希望將其永久化,則可以將302
更改為301
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.