[英]Wordpress cPanel Redirect to another site
In my Wordpress installation I have 3 sites: /blog/
, /blog/en
, /blog/pt
. 在我的Wordpress安装中,我有3个站点:
/blog/
, /blog/en
, /blog/pt
。 I want it so, that whenever someone accesses /blog/
, they will get redirected to /blog/pt
. 我想要这样,以便每当有人访问
/blog/
,他们都将被重定向到/blog/pt
。
I've already tried to create a Redirect inside my cPanel, but it's not working. 我已经尝试在cPanel中创建重定向,但是它不起作用。 I've done it like this:
我这样做是这样的:
Domain to Redirect: mysite.com/blog/
要重定向的域:
mysite.com/blog/
Site to Redirect to: mysite.com/blog/pt
. 网站重定向到:
mysite.com/blog/pt
。
But it's not working. 但这不起作用。 Any ideas?
有任何想法吗? I can probably do this with the .htaccess, but I don't understand any of it..
我可以用.htaccess做到这一点,但是我什么都不懂。
Here is my .htaccess: 这是我的.htaccess:
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
# RedirectMatch 301 ^/blog /blog/pt
您只需在.htaccess文件中添加以下内容即可实现所需的重定向。
RedirectMatch 301 ^/blog /blog/pt
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.