Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.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
通过.htaccess将文件夹段插入URL_.htaccess_Url_Redirect_Mod Rewrite_Url Rewriting - Fatal编程技术网

通过.htaccess将文件夹段插入URL

通过.htaccess将文件夹段插入URL,.htaccess,url,redirect,mod-rewrite,url-rewriting,.htaccess,Url,Redirect,Mod Rewrite,Url Rewriting,我想插入一个文件夹段到URL,如果该网站是与其他明确的文件夹段要求 例如: http://www.domain.tld/people/xyz至http://www.domain.tld/en/people/xyz 这种逻辑的前提是,只有在原始请求中的段/人/被给出时,它才应该重写它。附加的xyz是可变的 有人能解决这个问题吗?请在.htaccess文件顶部附近尝试以下操作: RewriteRule ^(people/.*) /en/$1 [R,L] /people/必须位于请求的URL的开头,

我想插入一个文件夹段到URL,如果该网站是与其他明确的文件夹段要求

例如:

http://www.domain.tld/people/xyz
http://www.domain.tld/en/people/xyz

这种逻辑的前提是,只有在原始请求中的段/人/被给出时,它才应该重写它。附加的xyz是可变的


有人能解决这个问题吗?

请在
.htaccess
文件顶部附近尝试以下操作:

RewriteRule ^(people/.*) /en/$1 [R,L]
/people/
必须位于请求的URL的开头,才能重定向此URL

如果这是一个永久重定向,请在确认其工作正常后,将
R
更改为
R=301