.htaccess 中的 Mod 重写?
我想实现从 http://www.onbip.com/index-en.html
到 http://www.onbip 的 301 重定向。 com/
在 htaccess 文件中我有:
- RewriteRule
^.htaccess$ - [F,L] #403 Forbidden
- RewriteRule
^inc/ - [F,L]
- 重写条件
%{HTTP_HOST} ^onbip\.com
- RewriteRule
^(.*)$ http://www.onbip.com/$1 [R=permanent,L]
- RewriteRule < code>^index-([^\.]+)\.html$ index.php?lang=$1 [L]
我需要标准化默认页面,该页面将是http://www.onbip.com/
怎么办?
I'd like to implement 301 redirection from http://www.onbip.com/index-en.html
to http://www.onbip.com/
In htaccess file I have:
- RewriteRule
^.htaccess$ - [F,L] #403 Forbidden
- RewriteRule
^inc/ - [F,L]
- RewriteCond
%{HTTP_HOST} ^onbip\.com
- RewriteRule
^(.*)$ http: //www.onbip.com/$1 [R=permanent,L]
- RewriteRule
^index-([^\.]+)\.html$ index.php?lang=$1 [L]
I Need to standardize the default page which will be http://www.onbip.com/
How?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在您的 httpd.conf 文件中,应该已经有一行禁止访问 .ht* 文件,可能如下所示:
如果您想冗余,使用 Files 或 FilesMatch 来保护它可能会很好。如果您想为此使用 Rewrite,您可以抛出 404,就好像它不存在一样。
这是目录 /inc 到 404 页面的重定向(不是 mod_rewrite),
位于 http://httpd.apache.org/docs/2.0/mod/mod_alias.html
现在重写
参见http://httpd.apache.org/docs/current/mod/mod_rewrite.html
最后一个将从服务器调用“/”,如果根据目录索引存在“index.php”,则首先调用“/”。
In your httpd.conf file, there should already be a line to forbid access to .ht* files that will probably look like this:
If you want to be redundent, using Files or FilesMatch to protect it would probably be good. If you want to use Rewrite for this, you could throw a 404 as though it doesn't exist.
Here is a redirect (not a mod_rewrite) for a directory /inc to a 404 page
This is at http://httpd.apache.org/docs/2.0/mod/mod_alias.html
Now for rewrite
see http://httpd.apache.org/docs/current/mod/mod_rewrite.html
The last will call "/" from the server which will be "index.php" first if it exists according to directory index.