Apache 使用.htaccess将根文件夹(旧URL)的所有.php文件重定向到新文件夹
我需要用.htaccess将根目录(旧URL)的所有Apache 使用.htaccess将根文件夹(旧URL)的所有.php文件重定向到新文件夹,apache,.htaccess,mod-rewrite,redirect,url-redirection,Apache,.htaccess,Mod Rewrite,Redirect,Url Redirection,我需要用.htaccess将根目录(旧URL)的所有.php文件重定向到已移动到新目录(新URL)的相同文件 e、 g: something.com/hasty.php,something.com/index.php 到 something.com/fold/hasty.php,something.com/fold/index.php 等等。此外: something.com/hector/hasty.php 到 something.com/fold/hector/hasty.php 请帮助,谢
.php
文件重定向到已移动到新目录(新URL)的相同文件
e、 g:
something.com/hasty.php
,something.com/index.php
到
something.com/fold/hasty.php
,something.com/fold/index.php
等等。此外:
something.com/hector/hasty.php
到
something.com/fold/hector/hasty.php
请帮助,谢谢。我认为正确的语法应该是:
Redirect 301 /handsome.php http://www.something.com/fold/handsome.php
Redirect 301 /index.php http://www.something.com/fold/index.php
Redirect 301 /hector/handsome.php http://www.something.com/fold/hector/handsome.php
在
.htaccess
文件中。进一步细节如下:.使用htaccess重定向
RedirectMatch 301 something.com/handsome.php(.*) something.com/index.php$1
RedirectMatch 301 something.com/fold/handsome.php(.*) something.com/fold/index.php$1
RedirectMatch 301 something.com/hector/handsome.php(.*) something.com/fold/hector/handsome.php$1
您可以使用htaccess工具重定向
对不起,StackOverflow不是免费的编码服务。我们在这里帮助彼此解决特定的编程问题,因此也解决您的代码问题。我们不是来为你工作的。因此,从你自己开始,如果你不熟悉这些东西,那么就阅读一些教程、文档和一些示例。然后,如果您的代码遇到了一个特定的问题,那么是时候在这里提问并将您的代码与您的问题一起发布了。这已经解释清楚了,我建议你通读当地的旅游,看看这个网站是如何运作的:@Kitty:你有没有尝试过解决这个问题?嗨!记住,如果有任何答案解决了问题,请将以下答案之一标记为已接受!:)