2014-02-14 05:48
浏览 19


I actually have PHP code for making 301 redirect on my site.Previously i done this by putting that PHP code on \public_html\site_name\index.php and that is not the same in www\site_name\index

(\public_html and \www are not same at that time).

But now these two folders(public_html and www) are showing the same content.Then now where i need to put the code?how to achieve 301 redirect using PHP when the *\public_html* and \www folders are in same.

图片转代码服务由CSDN问答提供 功能建议

我实际上有PHP代码在我的网站上进行301重定向。之前我通过将PHP代码放在< strong> \ public_html \ site_name \ index.php ,在 www \ site_name \ index

\ public_html)中不一样 和当时不一样。)

但现在这两个文件夹(public_html和www)显示的内容相同。然后 现在我需要放置代码?当* \ public_html *和 \ www 文件夹相同时,如何使用PHP 实现301重定向

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • dongxie5698 2014-02-14 07:01

    Give this a try, put this in your htaccess in the root of your site.

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^$
    RewriteRule (.*)$1 [R=301,L]

    replace with your domain.

    解决 无用
    打赏 举报
  • 查看更多回答(1条)

相关推荐 更多相似问题