.htaccess not working correctly.

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Help! I can't post the code for some reason, either. *yeargh*

http://www.zerocattle.com/examples/htaccess.txt

Apache 1.3.*

Just want to redirect folks with the wrong http_referer to the main entry point when they try to access a file in a folder.

Help?

Busy's picture

He has: 6,151 posts

Joined: May 2001

try add:

Options +FollowSymlinks

to the top of your htaccess file, not sure of the code bit, maybe try add an extra RewriteCond %{HTTP_REFERER} !^$ before the url ones, what I use for redirecting is 301's
ie:

redirect 301 /testview/ h ttp://www.finishsite.net/ (space added to stop it becoming link)

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

hehe.. You know busy, there is a checkbox that will prevent links as well.

Busy's picture

He has: 6,151 posts

Joined: May 2001

yeah but that means clicking the 'post reply' button first Wink

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

okay, Busy, what does that mean in English? I'm no server gal, so does it mean to follow links from the domain?

I know the other line is if there is no referer, rewrite. if the referer exists and is not those two urls, rewrite.

The Options +FollowSymlinks doesn't seem to work. I tried it with the + and without it.

http://httpd.apache.org/docs-2.1/en/mod/core.html#options explains it SOME, but I still miss the gist.

He has: 1,758 posts

Joined: Jul 2002

I was having probs doing rewrite rules with .htaccess the other day, no matter what i did they wouldnt work (to the point where no pages on the site would work!!), then i moved the rewrite rules to httpd.conf and they worked!

Andy

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

oh boy. I guess I'll have to try that. I fear the httpd.conf, though, especially since this isn't my server. Aiyee.

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

hmm... I hope it's not this simple, but is:
RewriteEngine On

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Sadly, no, but I tried all the options again with the Capitalization Fix.

What is happening is that ANY call to those files is getting bounced to the login, like the referers are not being recognized.

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

If a user comes from any of the referrers in your .htaccess, do you want them to get redirected or not?

Right now, the user should get redirected only if the refferer does not match any of the three conditions.

Mark Hensler
If there is no answer on Google, then there is no question.

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Man I love you guys.

Of course! I want it to redirect if there is no referer, not if there isn't no referer (doh!) so I needed to unnegate the top line. I think it's working properly now. See the link for the revised version, as I *still* cannot post this code to this forum for inexplicable reasons (hangs the browser).

*smooch* thank you!

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Also, for future folks wondering --

http://httpd.apache.org/docs/misc/rewriteguide.html

http://httpd.apache.org/docs-2.0/mod/mod_rewrite.html

EXCELLENT documentation, helpful examples and generally good resource. Coupled with helpful eyeballs, you can't miss. Heh.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.