Forum Moderators: phranque

Message Too Old, No Replies

Redirect base URL but not subdirectories?

Is this salvageable?

         

anallawalla

6:12 am on Jan 24, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



I have a subdomain - sub.domain.com - that contains some well-indexed specialist pages in subdirectories, e.g. sub.domain.com/furrywidgets

Some months ago, I forgot about the specialist pages and installed a script at the base URL that needs .htaccess to run the script. This worked great -- insatiable spider food, which got me banned by the shared host. Then I remembered that I had inadvertently clobbered my specialist pages, so I chucked out the new script and the .htaccess.

For at least two months since the change back, I see the spiders still coming and getting 404s for the phantom mod-rewritten pages that are no longer visible. They are not visiting the script's new home (not with the same vigour) at sub.newdomain.com. I am regretting the move of the script and am asking if I can run the script at the old location and keep the unrelated subdirectories intact?

jdMorgan

6:31 am on Jan 24, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well, there are always exceptions, but generally yes.

If you mean that
sub.domain.com/ is the script URL,
and you also wish to serve
sub.domain.com/furrywidgets
without activating the script, then all you'd need to do is test for the presence of characters following the domain name. If there are no characters after the "/", then rewrite to the script, otherwise try to serve the requested content. You might also have to exclude the script's actual name -- that is, /script.php or whatever it is, but still, that's a simple matter using regular expressions.

It always depends on the details...

As I said, there are always exceptions, and we seem to get more than our share here (because no-one usually needs help with easy stuff), but I'd say you've got a good chance here. :)

Jim