Mod_Rewrite 复杂!
我想在我的 .htaccess 中设置一个重定向/重写,执行以下操作:
我试图完成的一些重定向示例:
domain.com/08/04/10/file.php 到domain.com/新/file.php
domain.com/06/01/11/file2.php 到domain.com/new/file2.php
domain.com/07/12/07/file3.php 到domain.com/new/file3.php
你明白了。我什至不知道从哪里开始——有太多的子目录和子子目录,让我头晕目眩。我希望它们全部转到/new/filename.php。我正在尝试重定向 3 个子目录; /06/、/07/ 和 /08/。每个层下面有 2 个级别,第 3 层有一些 php 文件。关于如何开始有什么建议吗?
I'd like to set up a redirect/rewrite in my .htaccess that does the following:
A few samples of redirects I'm trying to accomplish:
domain.com/08/04/10/file.php to domain.com/new/file.php
domain.com/06/01/11/file2.php to domain.com/new/file2.php
domain.com/07/12/07/file3.php to domain.com/new/file3.php
You get the idea. I don't even know where to start - there are so many sub-directories and sub-sub-directories that my head is spinning. I want them all to go to /new/filename.php. There are 3 subdirectories I'm trying to redirect; /06/, /07/, and /08/. Each has 2 levels below it, and a few php files in the 3rd level. Any suggestions on how to start?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这应该将第一个变成第二个。
我假设您需要文件夹名称作为 PHP 调用中的参数,并且文件夹都是数字, 2 个字符,因为它看起来奇怪地像每部分 2 个字符的数据格式......但如果情况并非如此,请告诉我。
This should turn the first into the second.
I've assumed that you need the folder names as parameters in the PHP call, and that the folders will all be numeric, 2 characters, as it looks strangely like a 2-char-per-part data format ... but if that's not the case, let me know.