简单的Apache重定向问题 [英] simple apache redirect question

查看:142
本文介绍了简单的Apache重定向问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想建立一个简单的Apache重定向URL的重定向到网址B.

I would like to set up a simple apache redirect that redirects URL A to URL B

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

乙: 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

我想我接近,但它不工作。

I think I am close but it is not working.

推荐答案

您只能指定的 URL路径 重写规则 ,.htaccess文件中只是没了上下文路径preFIX的URL路径(在本例的情况下, / )。所以:

You can only specify the URL path in RewriteRule, in case of the .htaccess file only the URL path without the contextual path prefix (in this case /). So:

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

请注意,这将匹配的路径中的任何URL只是开始的有 / MSC-3 / FR ^ 标记字符串的开始。

Note that this will match any URL that’s path just begins with /msc3/fr as ^ marks the start of the string.

这篇关于简单的Apache重定向问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆