301 Yeniden yönlendirmeyi nasıl uygulayabilirim? Tüm 301 yönlendirme

Genel 192 görüntülenme Markdown



.htaccess 301 Redirect

Dosyanın proje klasörünün kök dizininde ve adının .htaccess olup olmadığı kontrol edin. nokta ile başlaması gerektiğini unutmayın.

Apache için Apache mod_rewrite modulünün aktif olduğunu teyit edin.

 
sudo a2enmod rewrite
 
 
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) https://www.yonlendirilen-yeni-site.com/$1 [R=301,L]
.htaccess ile tek sayfa yönlendirme
 
redirect 301 /eski.php https://www.yenidomain.com/abc/yenisayfa.html
.htaccess ile daha fazla yönlendirme örneği için aşağıdaki linki takip edebilirsiniz. https://makdos.blog/htaccess/238/redirect-301-htaccess-https-www-yonlendirme/

 

  PHP Redirect:

 

 
<?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: https:/yenidomain.com" );
?>
  Classic ASP Redirect:

 

 
<%@ Language=VBScript %>
<%
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", "http://www.yenidomain.com"
%>
  ASP.NET Redirect:

 

 
<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location","http://www.yenidomain.com");
}
</script> 
  IIS Redirect:

 

1. Internet services manager açıldıktan sonra yönlendirme yapılacak dosya/klasör üzerinde sağ tuş yapın.
2. "a redirection to a URL" menüsünü seçin
3. Yeni adresi yazın
4. "The exact url entered above" ve "A permanent redirection for this resource". seçimlerini teyit edin.
5. "Apply"

 

  IIS rewrite modulü indirmek için https://docs.microsoft.com/en-us/iis/extensions/url-rewrite-module/using-the-url-rewrite-module

 

web.config 301 Redirect:

 

Yönlendirilecek eski klasörün içinde web.config dosyası oluşturun.

 

<configuration>
<location path="eski.htm">
<system.webServer>
<httpRedirect enabled="true" destination="http://yenidomain.com/yeni/" httpResponseStatus="Permanent" />
</system.webServer>
</location>
<location path="eski2.htm">
<system.webServer>
<httpRedirect enabled="true" destination="http://yenidomain.com/yeni2" httpResponseStatus="Permanent" />
</system.webServer>
</location>
</configuration> 
 Dizin komple yönlendirilecek ise web.config içine
<httpRedirect enabled="true" destination="http://yenidomain.com/yeni" httpResponseStatus="Permanent" /> 
  ColdFusion:

 

<.cfheader statuscode="301" statustext="Moved permanently">
<.cfheader name="Location" value="https://www.yenidomain.com">

 

Faydalı oldu mu?

Geri bildiriminiz için teşekkürler!

Hâlâ Yardıma mı İhtiyacınız Var?

Bilgi bankasında bulamadığınız her şey için destek ekibi her zaman yanınızda.