u/blargy-blargy

▲ 4 r/apache+1 crossposts

.htaccess help!

I'm moving content from an old domain to a new one, but with a few catches. I want the home page from the old domain to go to a specific page on the new domain. And I want everything from a specific folder on the old domain to go to a new subdomain. I want pages and querystrings to convey too so the person who visits site A almost doesn't notice that they have been forwarded to site B.

Everying else can forward as it (and I have that part figured out!)

I have tried a ton of different ideas and none have worked so I'm running out of options. Here is what I have, or mostly want:

<IfModule mod_rewrite.c>

RewriteEngine On

# If / or /index.php redirect to newsite.org/index-alt.php (then stop! [END])
# the first challenge

# If /directory[/whatever] redirect to subdomain.newsite.org[/whatever] (then stop! [END])
# the second challenge

# Or redirect everything else to newsite.org[/everythingelse?etc]
# this works but is it the best solution?

RewriteRule .* https://newsite.org%{REQUEST\_URI} [R=302,L]

</IfModule>

reddit.com
u/blargy-blargy — 1 day ago