我在 joomla 中有一种情况,我必须为重定向编写 .htaccess 文件,这样如果我键入http://mysite.com/fold2
,它应该重定向到http://mysite.com/fold1/fold2
,但 URL 应该是mysite/fold2
.
您能否告诉我 .htaccess 文件中编写此代码的最佳位置在哪里?目前我认为是在:
RewriteEngine On
If you want to redirect using PHP, then add this code you the index.php file:
<?php
header("Location: http://yourdomain.com/");
exit;
?>
If you want to redirect using .htaccess, then I believ this will work
Redirect 301 / http://yourdomain.com/
Hope this is what you are looking for