Redirect with every thing after the domain name

fcbinfo

Well-Known Member
Dec 10, 2006
111
3
168
cPanel Access Level
Root Administrator
Tried to look for some tutorials of cPanel and Apache, but every thing that I found didn't solve my problem.
If you add parked domain and redirect this domain, it works, but not if you have something after the domain name.

Code:
http://www.domain.net to http://www.domain.com
This works...but

If you input something after the domain not work
Code:
http://www.domain.net/somenthinghere to http://www.domain.com/somethinghere
It still with .net and don't change to .com

Can someone help-me with this.
Thank you!
 
Last edited:

fcbinfo

Well-Known Member
Dec 10, 2006
111
3
168
cPanel Access Level
Root Administrator
Have found the solution, with default redirect of cPanel don't work, but with this configuration now I have it working. Look.

Original from cpanel redirect: (Not working)
Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain\.net$ [OR]
RewriteCond %{HTTP_HOST} ^www\.domain\.net$
RewriteRule ^/?$ "http\:\/\/www\.domain\.com\/$1" [R=301,L]

Working code, with redirect all the links after the domain
Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain\.net$ [OR]
RewriteCond %{HTTP_HOST} ^www\.domain\.net$
RewriteRule (.*)$ "http\:\/\/www\.domain\.com\/$1" [R=301,L]
Difference only on the ^/?$ to (.*)$
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,201
363
Hello :)

I am happy to see you were able to find a solution. Thank you for updating us with the outcome.