0

I've been searching for a while and have seen some similar questions but nothing exactly what I'm looking for.

I have two domains, let's say domain1.com and domain2.com. I am going to be migrating the content from domain1.com to the folder, domain2.com/page. Beyond that, ALL slugs will stay exactly the same. So, I'm going to want domain1.com to redirect to domain2.com/page , and any path like domain1.com/whatever to redirect to domain2.com/page/whatever and so forth. Would this be the code needed, or something else?

RewriteEngine On

# First condition, requested resource is not an existing file in domain1.com (this condition can be removed if needed)
RewriteCond %{REQUEST_FILENAME} !-f

# Second condition, requested resource is not an existing directory file in domain1.com (this condition can be removed if needed)
RewriteCond %{REQUEST_FILENAME} !-d

# Third condition, slug must exist
RewriteCond %{REQUEST_URI} !^/?$

# Do the redirection
RewriteRule ^(.*)$ http://domain2.com/$1 [R=301,QSA,L]
Chr1stch
  • 13
  • 2

1 Answers1

0

Simply do this :

Redirect HTTP://domain1.com HTTP://domain2.com/pages

Don't forget about the spaces.

Bahram
  • 13
  • 4