wtfmancmon
24 Feb 2007, 12:32 AM
i have done a little googling and found some scripts for putting a 301 redirect
i have a .net and a .com of the same website, i want to redirect the net so google doesnt pass me by in search rankings.
Redirect in ASP
<%@ Language=VBScript %>
<%
Response.Status="301 Moved Permanently" Response.AddHeader "Location", " http://www.new-url.com"
>
~~~~~~~~~~~~~~~~~~
Redirect to www (htaccess redirect)
Create a .htaccess file with the below code, it will ensure that all requests coming in to domain.com will get redirected to www.domain.com
The .htaccess file needs to be placed in the root directory of your old website (i.e the same directory where your index file is placed)
Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^domain.com [nc]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]
Please REPLACE domain.com and www.newdomain.com with your actual domain name.
Note* This .htaccess method of redirection works ONLY on Linux servers having the Apache Mod-Rewrite moduled enabled.
~~~~~~~~~~~~~~~~~~~~~
first i dont know how to create a .htaccess file.
i started dreamweaver and a new .ASP document and posted the code in, and it did nothing...
does it have to be called index.asp?
i just want to redirect using html or explained in more detail, thanks everyone!
i have a .net and a .com of the same website, i want to redirect the net so google doesnt pass me by in search rankings.
Redirect in ASP
<%@ Language=VBScript %>
<%
Response.Status="301 Moved Permanently" Response.AddHeader "Location", " http://www.new-url.com"
>
~~~~~~~~~~~~~~~~~~
Redirect to www (htaccess redirect)
Create a .htaccess file with the below code, it will ensure that all requests coming in to domain.com will get redirected to www.domain.com
The .htaccess file needs to be placed in the root directory of your old website (i.e the same directory where your index file is placed)
Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^domain.com [nc]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]
Please REPLACE domain.com and www.newdomain.com with your actual domain name.
Note* This .htaccess method of redirection works ONLY on Linux servers having the Apache Mod-Rewrite moduled enabled.
~~~~~~~~~~~~~~~~~~~~~
first i dont know how to create a .htaccess file.
i started dreamweaver and a new .ASP document and posted the code in, and it did nothing...
does it have to be called index.asp?
i just want to redirect using html or explained in more detail, thanks everyone!