문제

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.

도움이 되었습니까?

해결책

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

RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

replace example.com with your domain.

다른 팁

Create a .htaccess file in each of the directories with the folowing statement

Redirect 301 / http://anyothersite.com/
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top