Skip to main content
Code formatting
Source Link
MrWhite
  • 43.1k
  • 4
  • 50
  • 90

I have basic domain, for example, domain1.com. Also I have domain2.com which is addon domain, and I want to redirect domain2.com to domain.com?parameter=value, which is basically domain1.com, but with another template, but that path in URL stays same, domain2.com, not domain1.com. .htaccess file is created inside addon domain directory (public_html/domain2.com), and I have these two lines:

RewriteCond % ^domain2.com
RewriteRule ^(.*) http://domain1.com?parameter=value [P]

Rewrite works, but URL in browser changes to domain1.com.

EDIT: U have this code to .htaccess, but URL change to domain1.com, instead to stay on domain2.com.

RewriteCond %{HTTP_HOST} ^domain2.com$ [OR] RewriteCond %{HTTP_HOST} ^www.domain2.com$ RewriteRule ^/?$ "http://domain1.com/?parameter=value" [R=301,L]

RewriteCond %{HTTP_HOST} ^domain2\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.domain2\.com$
RewriteRule ^/?$ "http\:\/\/domain1\.com\/\?parameter\=value" [R=301,L]

I have basic domain, for example, domain1.com. Also I have domain2.com which is addon domain, and I want to redirect domain2.com to domain.com?parameter=value, which is basically domain1.com, but with another template, but that path in URL stays same, domain2.com, not domain1.com. .htaccess file is created inside addon domain directory (public_html/domain2.com), and I have these two lines:

RewriteCond % ^domain2.com
RewriteRule ^(.*) http://domain1.com?parameter=value [P]

Rewrite works, but URL in browser changes to domain1.com.

EDIT: U have this code to .htaccess, but URL change to domain1.com, instead to stay on domain2.com.

RewriteCond %{HTTP_HOST} ^domain2.com$ [OR] RewriteCond %{HTTP_HOST} ^www.domain2.com$ RewriteRule ^/?$ "http://domain1.com/?parameter=value" [R=301,L]

I have basic domain, for example, domain1.com. Also I have domain2.com which is addon domain, and I want to redirect domain2.com to domain.com?parameter=value, which is basically domain1.com, but with another template, but that path in URL stays same, domain2.com, not domain1.com. .htaccess file is created inside addon domain directory (public_html/domain2.com), and I have these two lines:

RewriteCond % ^domain2.com
RewriteRule ^(.*) http://domain1.com?parameter=value [P]

Rewrite works, but URL in browser changes to domain1.com.

EDIT: U have this code to .htaccess, but URL change to domain1.com, instead to stay on domain2.com.

RewriteCond %{HTTP_HOST} ^domain2\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.domain2\.com$
RewriteRule ^/?$ "http\:\/\/domain1\.com\/\?parameter\=value" [R=301,L]
added 270 characters in body
Source Link
Alan Kis
  • 247
  • 2
  • 4
  • 11

I have basic domain, for example, domain1.com. Also I have domain2.com which is addon domain, and I want to redirect domain2.com to domain.com?parameter=value, which is basically domain1.com, but with another template, but that path in URL stays same, domain2.com, not domain1.com. .htaccess file is created inside addon domain directory (public_html/domain2.com), and I have these two lines:

RewriteCond % ^domain2.com
RewriteRule ^(.*) http://domain1.com?parameter=value [P]

Rewrite works, but URL in browser changes to domain1.com.

EDIT: U have this code to .htaccess, but URL change to domain1.com, instead to stay on domain2.com.

RewriteCond %{HTTP_HOST} ^domain2.com$ [OR] RewriteCond %{HTTP_HOST} ^www.domain2.com$ RewriteRule ^/?$ "http://domain1.com/?parameter=value" [R=301,L]

I have basic domain, for example, domain1.com. Also I have domain2.com which is addon domain, and I want to redirect domain2.com to domain.com?parameter=value, which is basically domain1.com, but with another template, but that path in URL stays same, domain2.com, not domain1.com. .htaccess file is created inside addon domain directory (public_html/domain2.com), and I have these two lines:

RewriteCond % ^domain2.com
RewriteRule ^(.*) http://domain1.com?parameter=value [P]

Rewrite works, but URL in browser changes to domain1.com.

I have basic domain, for example, domain1.com. Also I have domain2.com which is addon domain, and I want to redirect domain2.com to domain.com?parameter=value, which is basically domain1.com, but with another template, but that path in URL stays same, domain2.com, not domain1.com. .htaccess file is created inside addon domain directory (public_html/domain2.com), and I have these two lines:

RewriteCond % ^domain2.com
RewriteRule ^(.*) http://domain1.com?parameter=value [P]

Rewrite works, but URL in browser changes to domain1.com.

EDIT: U have this code to .htaccess, but URL change to domain1.com, instead to stay on domain2.com.

RewriteCond %{HTTP_HOST} ^domain2.com$ [OR] RewriteCond %{HTTP_HOST} ^www.domain2.com$ RewriteRule ^/?$ "http://domain1.com/?parameter=value" [R=301,L]

Source Link
Alan Kis
  • 247
  • 2
  • 4
  • 11

.htaccess rewrite but keep basic URL

I have basic domain, for example, domain1.com. Also I have domain2.com which is addon domain, and I want to redirect domain2.com to domain.com?parameter=value, which is basically domain1.com, but with another template, but that path in URL stays same, domain2.com, not domain1.com. .htaccess file is created inside addon domain directory (public_html/domain2.com), and I have these two lines:

RewriteCond % ^domain2.com
RewriteRule ^(.*) http://domain1.com?parameter=value [P]

Rewrite works, but URL in browser changes to domain1.com.