i already did that and it works fine but i am not familiar with proxy and dont want to screw it up It seems that

mysql tries to use a transaction in mysql
it fails… but if I restart apache with php5 disabled, it works fine

getting an error?
Can you be more specific?

Can you not use ! in a RewriteCond %{REQUEST_URI} !^/foo ?

Yes, you can use ! in that context. Why do you ask?

Just having a bit of a rewrite issue, ^/foo works !^/foo doesn't. Rewrite_log see's the uri as /foo in both instances

Sure

Can you give a little more detail? "doesn't work" in what sense, precisely?

Transactions not supported by database at /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/DBI.pm line 1665.
it works

i can't seem to get custom error pages working
what might be the cause?

sure, using the !^/foo, a request for /bar and /foo result in the same thing (both being redirected by a Rule on the next line). With ^/foo the /bar request goes through and the /foo gest redirected

What exactly is happening, and in what way does it differ from what you want to be happening?
What, specifically, have you tried?

it just displays the default error message
i've saved a 404.shtml to the root of a site

so it seems that !^/foo should reverse that and redirect /foo but not /bar, but that doesn't seem to be the case

and i've added ErrorDocument to AllowOverride which matches the right pattern, in my case /home/*/public_html/
actually, scrap that last bit, made a typo, correcting

has AllowOverride All

i also have ErrorDocument 404 /404.shtml in my conf
not sure if it's in the right place though

any idears?

i'm trying to do it on a per site basis, so i've got ErrorDocument 404 /404.shtml in my .htaccess

Never set AllowOverride All in Directory /
Set it back to None there.

block that actually refers to your document directory.

it was like that when i found it

It's wrong.

fair enough, will change now

It doesn't matter who did it. It's wrong.

why is it bad, out of curiosity, i think my server management company set it that way you see

it will check every directory, down to / for .htaccess files

you're recursively allowing all overrides

then?

So, for example, you request a URL out of /home/foo/bar/public_html/wooga

no

it has Options All and AllowOverride ALL

It will look in / /home /home/foo on.

eep!

hi

Thus you're adding 5 additional file stats PER HTTP REQUEST
It's a huge performance hit, and a possible (though unlikely) security problem.
No, no ideas. It's possible that php and perl are ysing conflicting mysql libraries, but I don't know what to do to fix that.

ah yes, the file comments say "should be set to a very restrictive set of permissions"
AllowOverride None, then?
essentially the deal is, i pay a server management company to look after my servers, i've had this problem where clients can't get custom 404s working
so i contacted them
they said it's apaches fault, and they need to reinstall apache

Right. Reinistalling fixed everything.

You rolled a 6, DrBacchus!

which sounds like nonsense to me… it's not windows for god sakes, you don't just uninstall and reinstall something with no idea what the problem is

If they are unable to get stuff working in a .htaccess file, then it's most likely that AllowOverride is just not set in the right scope.

so i'm trying to figure this stuff out myself, with my limited knowledge of apache which rarley extends beond a few httpd.conf changes, and .htaccess stuff

?

AllowOverride All/directory

?

Yes, for the specific directory that will contain the .htaccess files.
Or a parent directory thereof.

so /home/*/public_html would be ok?

perhaps

Yes.

cool

The * gets interpolated to be whatever username.

that's in there, but commented out

Ah.
That'll do it.

?

nothing

nothing is _ALWAYS_ a wrong answer/description.

not in this case you piece of perl poo…
directory /

is a filesystem directory, not a URL path. If you put options in this block, don't be surprised when whatever you're trying to do doesn't work.

i see

directory / should contain allowoverride none, and it should contain deny from all

makes sense

I figured it out, certainly doesn't help to set that rewrite and then have the HTML load images from outside /foo

hi

hey, Cheef-Daniel.

i've sent a ticket to my server management company complaining about how badly httpd.conf has been set up
i'll see what they can do about it

I have some problem setting up my apache2 webserver right for shared webhosting. Problem is that I want allow my customers to set some php_values with htaccess-files, but not alloing them to set Options like ExecCGI

Cheef-Daniel: Well, the good news is that you don't have to work at that any longer.
Cheef-Daniel: The bad news, of course, is that you can't have it both ways.

After reading the manual, I cant still find out how i can enable php_value in htaccess but disable ExecCGI

You can't.

hm, thats bad

Both of them fall under 'AllowOverride Options'

yes this is what i found out and where the problem is
how does other hosters do this?

yes you can

They don't.

you can do an override options set
AllowOverride Options=blah,blah

Since when?

Since when is 'Include' a syntax error?

2.0?

Really?

allowoverride

AllowOverride tells Apache what things you wish to permit in .htaccess files. See http://httpd.apache.org/docs/2.2/mod/core.html#allowoverride

could be 2.2
i don't remember really

I have never seen that syntax. That's pretty cool. I wonder how I missed it.
I stand corrected.

ah… looks like 2.2

It appears to be 2.2, not 2.0

yeh

Options[=Option,…]
you are right

Cheef-Daniel: Are you running 2.2?

a good reason too…. :P

hi, i want to rewrite one url "host.where.you.came.from.com" to http://where.it.should.go.com and i'm doing it with these rules which doesn't work, what might be wrong ???
RewriteCond %{REQUEST_URI} host.where.you.came.from.com
RewriteRule ^(.*)$ http://where.it.should.go.com [P,L]

if you're not going to use the regex grouping, use ^ instead of .*

i'm upgrading it

yeah, but it still won't work

you must define what's not working. is this in an htaccess file? is it not redirecting? is it throwing an error?
please elaborate

httpd.conf

httpd.conf is the main apache configuration file.

it doesn't redirect it to that url
it is serving the site from virtualhost section

[p]

[p] is a proxypass. See http://rewrite.drbacchus.com/rewritewiki/Flags_2fP

is there a reason you're using the proxy flag?

hmm, no, i'll try without it

heh
Cheef-Daniel: yeh. 2.2 has quite a few improvements and functionality over previous versions.

it still doeasn't work

rewritelog

rewritelog is http://httpd.apache.org/docs-2.0/mod/mod_rewrite.html#rewritelog http://httpd.apache.org/docs/mod/mod_rewrite.html#rewritelog.
Use this logging to help design and track rewrite; see also rewriteloglevel; and cannot be used from .htaccess

oh
duh

A child of five could understand this! Fetch me a child of five

you're using the wrong env flag
host stuff won't be in request uri

oh.

you either want… %{HTTP_HOST} or %{REMOTE_HOST}
depending on where.you.came.from is…
or mebbe catching the referer
*shrugs*

great thx man
it works beautifull right now,
amazing

i'm guessing you'll probably want http_host
remote_host will most likely be an ip address

yeap it was it

unless you're using hostnamelookups

yeah, i didn't found in the man which one is for

well http_host is the host information that was access by the user
like if type http://foo.com into my browser, http_host would get foo.com
remote_host would get my ip address
and if on a page i click on a link to let's say an image on your server, the http_referer would have foo.com/page-where-link-was-clicked

how scalable is mod_rewrite?
in terms of scaling to thousands or tens of thousands of rules

.O

that would be fun to watch.

well head on over to #apache

what are you doing that would require that many rules?

blocking ip addresses

blocking ip addresses is really what iptables is for

wow

is there an htaccess channel?

fajita++

you could use a rewritemap instead of a zillion rules
although i agree with fajita about iptables

If you're using mod_rewrite to block IP addresses, you're solving the wrong problem.

we are using rewritemap, but it will have the same scalability right?

If you're using rewritemap, and the IP addresses are in a dbm file, you should be good. However, you're still using the wrong tool for the job.

yep
also, if you're using rewritemap, you shouldn't have tens of thousands of rules.

To redirect a users browser to a www. url I would do this in VirtualHost Directive via 301?

If you're using rewritemap, there should only be one rule, and it should be doing a single dbm file lookup.

hi

bonjour, fasl.

2.1 … so what should I use?

is there any module to block a country on apache?

Canada, eh?

So I can do this? Redirect 301 domain.com www.domain.com?

do you know where I can find which Options=[n] are allowed?
documentation says only Options[=Option,…]

anything which you can use in an Options directive
Options

Options is http://httpd.apache.org/docs/2.0/mod/core.html#options or http://httpd.apache.org/docs/1.3/mod/core.html#options or see 'Options Context' Don't mix
'relative' and 'absolute' values. See: http://www.onlamp.com/pub/a/apache/2005/09/08/apacheckbk.html

did you look at the examples in the redirect docs?

*
To prove that you're not a bot, enter this code
Anti-Spam Image

Comments are closed.


Blog Tags:

Similar posts: