我需要用.htaccess将根目录(旧URL)的所有.php文件重定向到已移动到新目录(新URL)的相同文件。
例如:
something.com/handsome.php,something.com/index.php
至
something.com/fold/handsome.php,something.com/fold/index.php
等等。另外:
something.com/hector/handsome.php
至
something.com/fold/hector/handsome.php
请帮帮忙,谢谢。
发布于 2015-12-09 01:49:07
我认为正确的语法应该是:
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文件中。更多信息在这里:http://www.htaccess-guide.com/redirects/。
发布于 2015-12-09 12:28:36
使用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工具http://www.webconfs.com/htaccess-redirect-generator.php进行重定向
https://stackoverflow.com/questions/34162361
复制相似问题