Portal Home > Knowledgebase > Articles Database > Redirect URL


Redirect URL




Posted by webhostbeginner, 04-13-2010, 03:46 AM
Hello, I changed my domain name, now the old domain parked on my new domain. because I have a forum I want to redirect all request from www.domainold.com/* to www.domainnew.com/* how can I do it with .htaccess ? Regards, majid

Posted by MikeDVB, 04-13-2010, 04:01 AM

Posted by webhostbeginner, 04-13-2010, 05:06 AM
both of domain names should be domainnew.com ? I forgot to say the new domain is subdomain, I mean olad domain is olddomain.com and new domain is forum.newdomain.com Regards, Majid

Posted by LeaTrueman, 04-13-2010, 05:23 AM
Please try the following, RewriteEngine On RewriteCond %{HTTP_HOST} !^www\.olddomain\.com$ RewriteRule ^(.*)$ http://www.forum.newdomain.com/$1 [R=301,L]

Posted by webhostbeginner, 04-13-2010, 05:55 AM
I got this error : The page isn't redirecting properly

Posted by ServerSitters_Paul, 04-13-2010, 08:13 AM
Try: RewriteEngine On RewriteCond %{HTTP_HOST} !^forum.newdomain.com RewriteRule ^.*$ http://forum.newdomain.com%{REQUEST_URI} [R]

Posted by webhostbeginner, 04-14-2010, 06:32 AM
this code work for me, thanks

Posted by ServerSitters_Paul, 04-14-2010, 07:34 AM
Glad to hear it worked - mod_rewrite can be a bit tricky.

Posted by MikeDVB, 04-14-2010, 02:31 PM
It's just a variation on what I originally posted. The first line checks to make sure you're not already on the new domain (if it didn't you'd get the redirection error you got before) and the second line does the redirection if you're not already there.

Posted by eonhost, 04-16-2010, 03:43 AM
You can also set up a redirect from the cpanel control panel, if you use it. There is an easy way to do it.



Was this answer helpful?

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

Also Read
Windows Reseller (Views: 708)
PostgreSQL and Tomcat (Views: 701)


Language: