I'm having some difficulty getting apache to behave how I want it to.
I got my virtual server working so that requests from a separate A record all go to it, and others go to the other main one, so that's great. I'm having a problem getting my mod_rewrite to work properly.
I had this working on the old server (where I wasn't using the other A record):
RewriteRule ^/g/(.*) /gurl.php?q=$1
For instance, that would take "http://www.example.com/g/QWERTY
" and translate it to "http://www.example.com/gurl.php?q=QWERTY
This was great, but I want the URLs to be even shorter, so I got a new URL and now the files are on the root. So, I want there to be 2 possible scripts for this: / and /STRING (where STRING is any possible word.
So, I tried this:
RewriteRule ^/(.+) /gurl.php?q=$1
RewriteRule ^/$ /index.php
But, it isn't working. What I want to happen is for ANYTHING after the / (root) to be translated and fed as a parameter to the script. If there is nothing after the / it should just show the index page.
Well, the index page is working (but it worked before this whole thing, so...).
Can anyone tellme what I am doing wrong, or if what I'm trying to do is possible? If I have to, I'll go back to having the "/g/" part in the URL, but the whole point of this is to make short URLs, so the more I can take out, the better.
Thanks in advance,