[英]Redirect all the .php files of root folder (old URLs) to new folder, with .htaccess
I need to redirect all the .php
files of root directory (old URLs) to the same files which have been moved to a new directory (new URLs), with .htaccess.我需要使用 .htaccess 将根目录(旧 URL)的所有.php
文件重定向到已移动到新目录(新 URL)的相同文件。
eg:例如:
something.com/handsome.php
, something.com/index.php
something.com/handsome.php
, something.com/index.php
to到
something.com/fold/handsome.php
, something.com/fold/index.php
something.com/fold/handsome.php
, something.com/fold/index.php
etc. Also:等等 还有:
something.com/hector/handsome.php
to到
something.com/fold/hector/handsome.php
Please help, Thanks.请帮忙,谢谢。
I think the correct syntax for you would be:我认为你的正确语法是:
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
in the .htaccess
file.在.htaccess
文件中。 Further detalis here: http://www.htaccess-guide.com/redirects/ .这里有更多细节: http ://www.htaccess-guide.com/redirects/。
Redirect using 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
You can redirect using htaccess tools http://www.webconfs.com/htaccess-redirect-generator.php您可以使用 htaccess 工具重定向http://www.webconfs.com/htaccess-redirect-generator.php
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.