Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/277.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 将具有/en/的所有内容重定向到特定页面_Php_Wordpress_.htaccess_Redirect - Fatal编程技术网

Php 将具有/en/的所有内容重定向到特定页面

Php 将具有/en/的所有内容重定向到特定页面,php,wordpress,.htaccess,redirect,Php,Wordpress,.htaccess,Redirect,我想有一个多语言的网站,但我还没有完成英文版,所以我想重定向,如果url有/en/到一个特定的网页与内容“很快”。此页面将是www.sitename.com/en/welcome 我在Wordpress上做这件事,我不知道。那太好了。这段代码实际上运行得很好,它检查语言集并相应地重定向,但问题是,在访问了我想访问www.sitename.com的url后,它仍然将我重定向到该页面(可能是因为语言环境没有改变) 我怎样才能正确地完成同样的事情? 我在htaccess中尝试过这个,但不起作用 Opt

我想有一个多语言的网站,但我还没有完成英文版,所以我想重定向,如果url有/en/到一个特定的网页与内容“很快”。此页面将是www.sitename.com/en/welcome

我在Wordpress上做这件事,我不知道。那太好了。这段代码实际上运行得很好,它检查语言集并相应地重定向,但问题是,在访问了我想访问www.sitename.com的url后,它仍然将我重定向到该页面(可能是因为语言环境没有改变)

我怎样才能正确地完成同样的事情? 我在htaccess中尝试过这个,但不起作用

Options +FollowSymLinks
RewriteEngine on
Redirect 301 ^/en/$ /en/welcome
这是Wordpress inside.htaccess提供的

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /web/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /web/index.php [L]

RewriteRule ^/en/$ /en/welcome [R=301]

</IfModule>
#开始WordPress
重新启动发动机
重写数据库/网络/
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/web/index.php[L]
重写规则^/en/$/en/welcome[R=301]

假设您已将所有内容安装在名为
/web
的目录中,则需要2个
。htaccess
文件:

/.htaccess(根WordPress.htaccess文件)


RewriteRule^/en/?$/en/welcome[R=301,NC,L]
-
重定向
处理的字符串不是RegExps IIRC,因此将是
重定向301”/en”“/en/welcome”
谢谢你,但我无法正常工作:/I我已经用Wordpress所说的编辑了代码,我怀疑
RewriteBase/web/
在工作中使用了扳手…该网站是临时设置在/web上的。。。所以www.site.com/web/en应该重定向到www.site.com/web/en/welcomefactly-目录
/web/en/
是否确实存在?都是关于那个路由器的我想。。。
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /web/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /web/index.php [L]

RewriteRule ^/en/$ /en/welcome [R=301]

</IfModule>
# BEGIN WordPress
<IfModule mod_rewrite.c>

RewriteEngine On

# the base directory
RewriteBase /web/

# this means "don't rewrite /web/index.php"
RewriteRule ^index\.php$ - [L]

# this is a router any URL that's neither a file
# nor a directory will be routed to /web/index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /web/index.php [L]

</IfModule>
RewriteEngine On
RewriteRule ^en/?$ /web/en/welcome [NC,L,R=302]