Forum Moderators: phranque

Message Too Old, No Replies

mod_rewrite not working!

urgent - pls help

         

deepadev

2:12 pm on Nov 9, 2005 (gmt 0)

10+ Year Member



I have Apache 2.0.52 installed on 2 diff servers -
I want to redirect requests from [my.second.server.IP...] to [my.first.server.IP...]
because cgi-bin/appname is installed only in my.first.server.IP

so I gave the rewrites as follows :

on my second server I have :

LoadModule rewrite_module modules/mod_rewrite.so

RewriteEngine On
RewriteRule ^/appname/(.*)$ [my.first.server.IP...] [R=permanent]
RewriteRule ^/cgi-bin/appname/(.*)$ [my.first.server.IP...] [R=permanent]

Ultimately both my.first.serv.IP and my.second.server.IP both get resolved to my.site.name

Questions :

1. Is the syntax right? Cos its not working :(

2. Do I need to set any permissions for the rewrite to work? If so where?

Pls help .. feelin lost ..

Thanks in advance,
Deepa

jd01

9:25 pm on Nov 9, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Deepa,

Welcome to WebmasterWorld.

Are your rules in the .htaccess or in the httpd.conf file?
If they are in the .htaccess, you will need to remove the preceding / from the left side of your rule.

In the either the httpd.conf or .htaccess file, you will need to have the following setting:
Options +FollowSymLinks

In the httpd.conf file, you will need to have the following setting:
AllowOverride FileInfo
(at least, usually do not recommend setting to all for security reasons, but it will work.)

Please, let us know if this helps, and elaborate on 'does not work'

Justin

Romeo

9:41 pm on Nov 9, 2005 (gmt 0)

10+ Year Member



'not working' ... does the server start?
Any messages during start about the rewrite module?

In my loadmodule config I have the full path of the mod_rewrite.so in the LoadModule statement, so try this first:
LoadModule rewrite_module /full/path/to/mod_rewrite.so

Regards,
R.

deepadev

5:17 am on Nov 10, 2005 (gmt 0)

10+ Year Member



hi Justin & R. ,

thanks for the replies - here are a few more details :

1. my rewrite rules are in my httpd.conf

2. by "not working", I meant - when I try to access [my.second.server.ip...] - it is throwing a 404 instead of resolving to [my.first.server.ip...]

3. when I try the [my.second.server.ip...] - in the apache's error_log I can see this :
script not found or unable to stat : /usr/apache/cgi-bin/appname

4. I have a ScritpAlias entry as well as an AddHandler entry for cgi - in my httpd.conf

Question : is Options +FollowSymLinks alone sufficient? Wil try it out anyways.

Let me know if the extra info helps ..

Thanks you guys,
Deepa

deepadev

6:01 am on Nov 10, 2005 (gmt 0)

10+ Year Member



Hi Justin & Romeo,

Here's an update after I tried the things u guys suggested:

1. I had the entries

<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>

which I changed to
<Directory />
Options +FollowSymLinks
AllowOverride FileInfo
</Directory>

and restarted apache - and checked - still throws a 404

2. Gave the full path to mod_rewite as

LoadModule rewrite_module /usr/apache/module/mod_rewrite.so

This also didnt make a diff - still throws 404.

any ideas? Am I doing something wrong in the conf file?

Let me know ..

Thanks,
Deepa