Redirection Problem in Website: Please Help me Out!

Web tabanlı uygulama geliştirme araçları(PHP, ASP vb...) ile ilgili konuları buraya yazabilirsiniz.
Cevapla
Mariareese
Üye
Mesajlar: 3
Kayıt: 24 Eyl 2014 03:43

Redirection Problem in Website: Please Help me Out!

Mesaj gönderen Mariareese »

Hello all of you, I am new to programming, I have a problem with my website, I want to redirect my website from serpmagics.in to www.serpmagics.in (non www to www).. I am using .htaccess file for redirection as I have read somewhere, but it is not working. I think maybe my .htaccess code is wrong or maybe server problem.


my .htaccess code is:

Options +FollowSymLinks
RewriteEngine on
# index.html to /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.html\ HTTP/
RewriteRule ^(.*)index\.html$ /$1 [R=301,L]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

Please help me out.. thanks in advance!
En son Mariareese tarafından 14 Eyl 2017 12:18 tarihinde düzenlendi, toplamda 1 kere düzenlendi.
akdatilla
Üye
Mesajlar: 292
Kayıt: 02 Nis 2006 06:04
Konum: Antalya

Re: Redirection Problem in Website: Please Help me Out!

Mesaj gönderen akdatilla »

if you are using php, write the following code on the top of the 'index.php' page:

Kod: Tümünü seç

<?
	if (strpos($_SERVER['HTTP_HOST'],"www.")===false)
	{
	Header( "HTTP/1.1 301 Moved Permanently" ); 
	Header( "Location: "."http://www.virtuoso.co.in".$_SERVER["PHP_SELF"]); 
	exit();
	}
?>
Mariareese
Üye
Mesajlar: 3
Kayıt: 24 Eyl 2014 03:43

Re: Redirection Problem in Website: Please Help me Out!

Mesaj gönderen Mariareese »

Got it, I have discussed about there issues, I read that it can also be fixed using cPanel. Anyways, Thanku for helping me out .. :)
Cevapla