Forum Moderators: phranque

Message Too Old, No Replies

htaccess file to redirect domain but excluding a sub directory

Written some code but suspect it's wrong and don't want to break the intran

         

grberry

10:39 am on Oct 19, 2007 (gmt 0)

10+ Year Member



Hi,

I need to redirect an old domain to a new one. But the intranet is in a subfolder of the main site. Obviously this is not ideal but you get what your given don't you.

I think this code should do it from what I've read, but can't risk taking down the intranet for long while I try to work out where it went wrong.

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(intranet) - [L]
RewriteRule (.*) [example...] [R=301,L]

Does this make sense?

Any help would be really great,

thanks,
Gareth

P.S. this is my first day doing this so it's probably horribly wrong!

jdMorgan

12:46 pm on Oct 19, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It would be helpful to us if you could post a full URL-path example for both intranet and non-intranet requests (examplified, please).

Also, in your code snippet, parentheses are not needed on the first RewriteRule pattern, as no back-reference is needed, and no group quantifier is being used.

Jim

grberry

3:09 pm on Oct 19, 2007 (gmt 0)

10+ Year Member



Ok then.

These are the URLs:
Intranet: www.example.example.example.sch.uk/myinternet
Non-Intranet: www.example.example.example.sch.uk

So the code should look like this?

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^intranet - [L]
RewriteRule (.*) [example...] [R=301,L]

Oh in case this helps the file structure is:

-Server
--ftp
--logs
--www
---intranet

So the intranet directory is inside the www directory

Does that make sense?

Thanks very much,

Gareth

To meet the go live date I've had to do a meta refresh thing in the header - blah