Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.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
简单的apache重定向问题_Apache_Url_Rewrite - Fatal编程技术网

简单的apache重定向问题

简单的apache重定向问题,apache,url,rewrite,Apache,Url,Rewrite,我想设置一个简单的apache重定向,将URL a重定向到URL B 答:http://myURL.example/msc3/fr B:http://myURL.example/msc3/fr/index_fr Options +FollowSymLinks RewriteEngine On RewriteBase / RewriteRule http://myURL.example/msc3/fr http://myURL.example/msc3/fr/index_fr 我想我很接近了

我想设置一个简单的apache重定向,将URL a重定向到URL B

答:
http://myURL.example/msc3/fr

B:
http://myURL.example/msc3/fr/index_fr

Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule  http://myURL.example/msc3/fr  http://myURL.example/msc3/fr/index_fr
我想我很接近了,但它不起作用。

对于.htaccess文件,您只能在中指定URL路径,而没有上下文路径前缀(在本例中为
/
)。因此:

请注意,这将匹配路径以
/msc3/fr
开头的任何URL,因为
^
标记字符串的开头

RewriteRule  ^msc3/fr  http://example.com/msc3/fr/index_fr