.htaccess 中的 301 重定向
301 Redirection in .htaccess
我正在尝试重定向 URL,在 .htaccess 文件中使用以下行:
redirect 301 /old_file_path /new_file_path
重定向工作正常,但我得到的 URL 格式不同:
/new_file_path/?/old_file_path
我该如何解决这个问题?
您应该重定向到完整的新路径:
redirect 301 /old_file_path https://example.com/new_file_path
请按照以下示例操作:
Redirect 301 /oldpage.html http://www.yoursite.com/newpage.html
Redirect 301 /oldpage2.html http://www.yoursite.com/folder/
或与您分享完整的 .htaccess 文件,以便我们更好地查看。
确保 mod_rewrite apachi 模块已打开。
我最后测试了代码,它工作正常。
RewriteEngine on
Redirect 302 /master-trainer https://www.keleven.com/master_trainer_course
希望对您有所帮助。
我正在尝试重定向 URL,在 .htaccess 文件中使用以下行:
redirect 301 /old_file_path /new_file_path
重定向工作正常,但我得到的 URL 格式不同:
/new_file_path/?/old_file_path
我该如何解决这个问题?
您应该重定向到完整的新路径:
redirect 301 /old_file_path https://example.com/new_file_path
请按照以下示例操作:
Redirect 301 /oldpage.html http://www.yoursite.com/newpage.html
Redirect 301 /oldpage2.html http://www.yoursite.com/folder/
或与您分享完整的 .htaccess 文件,以便我们更好地查看。
确保 mod_rewrite apachi 模块已打开。
我最后测试了代码,它工作正常。
RewriteEngine on
Redirect 302 /master-trainer https://www.keleven.com/master_trainer_course
希望对您有所帮助。