htaccess的重定向文件夹

编程入门 行业动态 更新时间:2024-10-21 09:26:47
本文介绍了htaccess的重定向文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

所有,

我想重定向来 HTTP的所有流量:// mysite的/ 到的 HTTP:// mysite的/公共的文件夹中。目前我使用下面的.htaccess文件这样做的,它的工作原理为根目录。但是,如果我浏览到的http:// mysite的/应用,它不重定向,并显示目录列表。我希望所有的流量,无论它是什么文件夹重定向到的http:// mysite的/公共文件夹

I want to redirect all traffic that comes to mysite/ to mysite/public folder. Currently I am doing this using the below in an .htaccess file and it works for the root directory. But if I browse to mysite/application, it doesn't redirect and shows the directory listing. I want all traffic regardless of what folder it is to redirect to mysite/public folder

RedirectMatch permanent ^/*$ /public/

感谢

推荐答案

试试这个 mod_rewrite的例如:

RewriteEngine on RewriteRule !^public/ /public%{REQUEST_URI} [L,R=301]

更多推荐

htaccess的重定向文件夹

本文发布于:2023-10-31 13:06:04,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1546172.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件夹   重定向   htaccess

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!