Portal Home > Knowledgebase > Articles Database > HTACCESS - Need help in Permanent Redirection Issue


HTACCESS - Need help in Permanent Redirection Issue




Posted by cosmicx, 02-13-2012, 06:09 AM
hello gurus, as part of my learning, i've encountered the subject htaccess. there is one issue i wanted to ask and clear about, if it's possible to accomplish. facts: i have 2 separate domain on the same server. -country based domain, http://national-site.ph -regional based domain, http://regional-site.ph i want to redirect my regional based domain name to a sub-domain of my country based domain. it's like this, http://regional-site.ph shall be redirected to http://regional-site.national-site.ph and after redirection, the address bar in the browser shall display http://regional-site.ph instead of http://regional-site.national-site.ph

Posted by SASA Techno, 02-13-2012, 07:07 AM
Hi you use in 301 redirection for details as under: PHP Redirect ASP Redirect <%@ Language=VBScript %> <% Response.Status="301 Moved Permanently" Response.AddHeader "Location","http://www.new-url.com/" %> ASP .NET Redirect JSP (Java) Redirect <% response.setStatus(301); response.setHeader( "Location", "http://www.new-url.com/" ); response.setHeader( "Connection", "close" ); %> CGI PERL Redirect $q = new CGI; print $q->redirect("http://www.new-url.com/"); Ruby on Rails Redirect def old_action headers["Status"] = "301 Moved Permanently" redirect_to "http://www.new-url.com/" end Redirect Old domain to New domain (htaccess redirect) Create a .htaccess file with the below code, it will ensure that all your directories and pages of your old domain will get correctly redirected to your new domain. 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 RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L] Please REPLACE www.newdomain.com in the above code with your actual domain name. In addition to the redirect I would suggest that you contact every backlinking site to modify their backlink to point to your new website.

Posted by cosmicx, 02-13-2012, 08:15 AM
SASA Techno thanks... can i try this and apply while using wamp? or do i need to create a real site, so i may test this functionality?

Posted by SASA Techno, 02-13-2012, 08:38 AM
Yes you use it but make sure which language your site crate like a PHP Or HTML. only for htaccess.



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
HudsonValleyHost (Views: 827)
Server Centre Limited (Views: 791)


Language:

LoadingRetrieving latest tweet...

Back to Top Copyright © 2018 DC International LLC. - All Rights Reserved.