Page 1 of 1

htaccess redirect

Posted: Tue May 15, 2007 9:27 pm
by rj
I have a website in the root, my graphics in /graphics and the blog in /serendipity. I need all external arrivals to end up at the blog, /serendipity and keep the website viable. (and hopefully pass the website Google Rank on to the BLog)

root
index.htm
pages.htm
*.js
*.swf
/serendipity
/graphics


My problem seems to be that once the redirect goes into affect the paths ALL change.

I understand I should put the website and its index file in a new directory, but will that directory have to go under /serendipity?
And will the /graphics directory also have to go in under /serendipity?

Moving the website isn't as big of a problem as moving the /graphics which contain many hundreds of graphics on both the blog and the website linking to it.

I have the .htaccess code to do the redirect from the domain (root) to /serendipity.

But is there some way of adding more code to HOLD the path for the graphics where it is?

Am I making more sense than I used to? :)


RJ

Re: htaccess redirect

Posted: Wed May 16, 2007 11:41 am
by garvinhicking
Hi!

You might need to go to a more htaccess/redirection related forum to get better help on this issue. Since it is quite unrelated to Serendipity, you might not get help here on this forum.

It's actually leading to the same questions that have been raised in another thread by you, so supposedly nothing new can be provided here. :)

Best regards,
Garvin

Posted: Wed May 16, 2007 1:50 pm
by rj
I undersand that!
I joined three and am not getting any replies. :)
Path of least resistance. :)

Posted: Wed May 16, 2007 4:52 pm
by judebert
Okay, you've said that you've got the code to redirect the original website/root calls to Serendipity. You're mostly there.

I gather that, since that .htaccess is in the root directory, it's affecting calls to website/ and graphics/. You want that to stop, immediately.

Good news! When Apache reads the .htaccess, it goes down subdirectories. To turn off redirection and rewriting for calls to subdirectories, just add this .htaccess to them:

Code: Select all

RewriteEngine off
Put that in website/ and graphics/, and then calls to (for instance) yourdomain/graphics/important.png will not be redirected to Serendipity any more.

If you want to leave the original website files in the root directory, you'll need to add some lines in the .htaccess specifically for them.

Posted: Thu May 17, 2007 1:19 am
by rj
Ouuu.... I understand the directories part!! :)

Let me get this other part right in my head.
If I have 50 htm pages in the root for the old website, INCLUDING the index.html file, I add to the root .htaccess file a pointer/code to each of them.

Lets try the BIGGIE! For if I can make this one work I can do the rest easy enough. Just the index.html file in the root.

here is my working redirect:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^rackjite\.com
RewriteRule ^(.*)$ http://rackjite.com/serendipity/$1 [R=permanent,L]

Now, what would be the code to apply the OFF for index.html underneath that?

Sorry to bother yall with this but I have now joined 4 redirect forums and no one is replying after many days...

RJ

Posted: Thu May 17, 2007 6:35 pm
by judebert
Let me get this other part right in my head.
If I have 50 htm pages in the root for the old website, INCLUDING the index.html file, I add to the root .htaccess file a pointer/code to each of them.
IF: you currently redirect all requests in the root directory to Serendipity,

AND: you want the old web pages in the root directory to be accessible without redirecting to Serendipity,

THEN: you'll have to put pointers to each of the original files in your root directory's .htaccess.

I think that's what you wanted, so the short answer is "yes". Just verify before you do anything disappointing.
Lets try the BIGGIE! For if I can make this one work I can do the rest easy enough. Just the index.html file in the root.
Should be easy enough. I understand you just said: "I want to redirect everything in the root directory to Serendipity except the root directory index.html, which should be accessed directly."

Using your provided .htaccess, here's what you'll need:

Code: Select all

RewriteEngine on
RewriteRule index.html index.html [L]
RewriteCond %{HTTP_HOST} ^rackjite\.com
RewriteRule ^(.*)$ http://rackjite.com/serendipity/$1 [R=permanent,L] 
I've added one line to be processed before the Serendipity redirect. It says, "for index.html, use index.html and consider this the Last rule you need to process."

If you wanted to move the index.html under a different directory, say, website/, you could do this instead:

Code: Select all

RewriteEngine on
RewriteRule index.html website/index.html
RewriteCond %{HTTP_HOST} ^rackjite\.com
RewriteRule ^(.*)$ http://rackjite.com/serendipity/$1 [R=permanent,L] 
I think you can figure that one out yourself. ;-) And of course, if you want other pages, you basically just duplicate that line for each page.

Posted: Fri May 18, 2007 2:00 am
by rj
boyohboyohboy ohboy!
It all worked.
But I turned it off for a spell because I have to either put all 50 web pages into code lines or decide to put it all in a directory.
That OFF in the graphics directory was a godsend!

I owe ya a big one Judebert!


RJ

Posted: Fri May 18, 2007 7:25 pm
by judebert
Happy to help out. Wanna buy me a tank of gas? Or my wishlist has stuff that's much less expensive. 8)