Forum Moderators: phranque

Message Too Old, No Replies

Mod rewrite not working for sub-domain

I need a rewrite rule that works on root domain to work on a sub-domain

         

espmartin

4:11 am on Apr 24, 2007 (gmt 0)

10+ Year Member



Hello,

I have a php site that automatically takes paypal payments
to submit a URL to the site (word cloud).

When the .htaccess for the script is run in a sub-folder on
the root domain, it works.

RewriteRule ^buy/(.*)$ buyit.php?word=$1 [L]

But when it runs on a sub-domain (which is what I need), it generates
500 server error (mod_rewrite stuff).

So, I need to have the rewrite rule above work for the sub-domain,
and not a sub-folder on the root domain:

WORKS (but not where I need it):

www.thesite.com/sub/sub/

NOT WORKING (but where I need it):

sub-domain.thesite.com/

I hope I'm not too muddy! Can anyone help?

espmartin

4:54 am on Apr 24, 2007 (gmt 0)

10+ Year Member



Hello All,

Fixed it!

I needed to add:

RewriteBase /

Thanks be to God and Google!

jdMorgan

3:01 pm on Apr 24, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Glad you got it fixed -- I was still wondering what the problem might be...

Jim

espmartin

3:15 pm on Apr 24, 2007 (gmt 0)

10+ Year Member



I'm assuming it's because the rewrite is assuming "root access":

RewriteRule ^buy/

So, ^ is watching for root-of-site, then the variable "buy".
It says, "ok, I see a match here, so I need to rewrite
this according to the next rule...

Adding:

RewriteBase /

I assume, is telling it to "assume" where it's at is now considered
root, or "base".

If I'm wrong, please someone enlighten me, but at least it's working
non-the-less ;)