views:

24

answers:

1

I am trying to move my current site over to a new domain, except for ONE directory.

Example:

  • current site: oldsite.olddomain.example
  • new site: newdomain.example

So I know I can create an .htaccess redirect entry to do this, and it works, but I want ONE exception - I do NOT want to redirect a specific directory. I still want this to work:

http://oldsite.olddmain.example/myspecialdirectory/… and every file and directory under it.

Can someone help? Thanks!

A: 

Try this mod_rewrite rule in the .htaccess file in the document root of oldsite.olddomain.example:

RewriteEngine on
RewriteRule !^myspecialdirectory($|/) http://newdomain.example%{REQUEST_URI} [L,R=301]
Gumbo
perfect, thank you
Scott