Rewite. It'stoo complicated to understand.

Rewite. It'stoo complicated to understand.

Post by Shtirlit » Wed, 22 Nov 2000 06:49:34



I've tried to understand how does mod_rewite work. But it seems to be
impossible for me to understand it.
Pls, can someone help me with the following examples.

Here is the first one. I need to redirect all requests which came to
http://www.veryComputer.com/*  to http://www.veryComputer.com/. Here is the part
of .htaccess file which works, but Ican't understand how does it work.

Rewri*gine On (I turn On rewirute engine)

RewriteCond %{HTTP_HOST} ^www\.mysite\.ru [NC] (here I analyze the
host name. Should I use "\."  or it's enough to use just simple '.' in
HTTP_HOST?)

RewriteRule .* http://www.veryComputer.com/ [L,R] (And here I can't
understand what does ".*" mean. And what is the difference between
"^$" or "^/$").

Help me pls.

 
 
 

Rewite. It'stoo complicated to understand.

Post by adam » Wed, 22 Nov 2000 04:00:00



> I've tried to understand how does mod_rewite work. But it seems to be
> impossible for me to understand it.
> Pls, can someone help me with the following examples.

> Here is the first one. I need to redirect all requests which came to
> http://www.veryComputer.com/*  to http://www.veryComputer.com/. Here is the part
> of .htaccess file which works, but Ican't understand how does it work.

> Rewri*gine On (I turn On rewirute engine)

> RewriteCond %{HTTP_HOST} ^www\.mysite\.ru [NC] (here I analyze the
> host name. Should I use "\."  or it's enough to use just simple '.' in
> HTTP_HOST?)

Your syntax is fine.  

Quote:> RewriteRule .* http://www.veryComputer.com/ [L,R] (And here I can't
> understand what does ".*" mean. And what is the difference between
> "^$" or "^/$").

This should be fine too.  .* means to match 0 or more of anything.  More
completely, "." means anything and "*" means 0 or more of the character
before it.  ^ matches the beginning of the string (hence your ^www in
the RewriteCond), $ matches the end of the string.  It would appear that
this rewrite should be working.  Things to check:

1) Does the server allow you to use .htaccess files.  If you're not the
admin, ask them.
2) Does the server have mod_rewrite compiled or loaded in?
3) Will the server allow you to use  mod_rewrite directives in a
.htaccess (I'm not sure
 specifically which AllowOverride directives are required for this to
work, but if the
 error_log says anything about directive not allowed here, its a good
clue).
4) Use the RewriteLog and RewriteLogLevel directives to turn on some
debugging.  If you can't figure it out, post some of the debugging
output and we'll try to help (level 4-5 is a good place to start).

For regular expressions (what ., *, ^, $, etc mean) look at:
http://www.veryComputer.com/#regex

-adam

 
 
 

1. 'make' fails, and I don't understand the error msg

I'm trying to install zsh on a Solaris box at work. I'm a newbie with
Unix installation, so I'm just going to install it in my home
directory, rather than risk messing up the machine for others. I've
done so with a couple of other Unix apps, and it has worked find.

I downloaded it, unpacked it, cd'ed into the directory that resulted
from the unpacking, and ran ./configure as follows:

./configure --disable-etcdir --prefix=/home/tuang/bin/zsh/here

That worked fine, as it has with other apps that I've installed in my
home dir.

Then, I typed "make" as usual, but I got an odd error message this
time that comes back to me almost immediately:

$ make
/bin/sh: Src: does not exist
make: *** [all] Error 1

I'm so new at this, that I don't know what that error message is
saying. I'm guessing that make runs a shell script that uses the
/bin/sh shell. (I typed /bin/sh and verified that this shell exists.)
I think the /bin/sh shell is telling me that "Src" doesn't exist. I
don't know whether that's a directory or a file or something else, but
the Src *directory* certainly does exist. In the same directory where
I typed ./configure and make, if I do an ls, this is what I get:

$ ls
ChangeLog        META-FAQ         aclocal.m4       configure*
ChangeLog-3.1    Makefile         aczsh.m4         configure.ac
ChangeLog.3.0    Makefile.in      config.cache     configure.in
Completion/      Misc/            config.guess*    install-sh*
Config/          README           config.h         mkinstalldirs*
Doc/             Src/             config.h.in      stamp-h
Etc/             StartupFiles/    config.log       stamp-h.in
Functions/       Test/            config.modules   zshconfig.ac
INSTALL          Util/            config.status*
LICENCE          acconfig.h       config.sub*

I read README and INSTALL. I looked in the files Makefile and
Makefile.in for the string "does not exist" to see if the error was
coming from those files and might include a comment, but that string
wasn't in either file. In "install-sh", I did find

echo "install:  $src does not exist"

but I don't think that's it. I think the resemblance to my error msg
is a coincidence (but of course I'm not sure).

Google searching hasn't gotten me anywhere this time either, so I'd be
grateful for any tips. What program is telling me this, and what does
it mean? What did I do wrong, and how can I do it right?

Thanks.

2. VideoCard in BlackCat 6.02

3. doesn't sendmail understand 'm' flag ?

4. cirrus logic video card 546X1.7

5. expect script doesn't understand '$1' from command line?

6. Reno Linux Users Group

7. I don't understand the '\'

8. 3rd party disk on a SUN Ultra 10

9. I don't understand why this code isn't working

10. 'make' error - I must not understand make correctly

11. NewB needs help understanding 'netstat' output

12. Help needed to understand 'kitrace' debugger

13. PPP to Win NT RAS, I don't understand what's going on... help !