Problems with Apache Configuration file and mod_rewrite

Status
Not open for further replies.

Deep

Version 2.0
Hi,
I am not sure whether ppl would be aware of this stuff or not but still i am giving it a try and wait for replies :roll:

so here i go...


Hi,
I am playing around with this mod_rewrite thing for a while now but it does not work on my local server but same thing works on other server..

I upgraded apache to 1.3.31 on Redhat linux 7.2 using following commands..

Code:
./configure --prefix=/path/to/apache --enable-module=so --enable-module=rewrite --enable-shared=rewrite

make

make install

it worked fine..

it installed apache without any errors..

now in httpd.conf i added these 2 lines for the first time..

Code:
LoadModule rewrite_module libexec/mod_rewrite.so

AddModule mod_rewrite.c

(I did not find mod_rewrite.so in apache tar installation file so I copied file from old pre-installed version of apache [1.3.23] to libexec directory)

and restarted the apache..it worked without any errors...

it showed mod_rewrite module under Apache Modules option in Webmin


so after all these i removed that AddModule line from httpd.conf, i started with simple mod_rewrite rule...but it showed me page cannot be displayed error


here is what i had written in the rule (in .htaccess file)

Code:
Options +FollowSymLinks

RewriteEngine on

RewriteRule id(.*)\.htm$ id.php?id=$1

i.e. id.php?id=5 --> id5.htm

I checked the same code by uploading it to the server online..and it worked fine...

Can any of these problems could be problem..

1. I used mod_rewrite.so from older version of apache, if that can be reason then how to get so file for latest version ? (is it something like when i add mod_rewrite.c in httpd.conf it will automatically generated so file or something?)

2. there is no mod_rewrite.o file in the modules directory under apache_dir/src/modules/standard/, i found mod_rewrite.c and mod_rewrite.h there. (for other modules .o files were present with .c files)

3. I could not find mod_rewrite module under Re-Configure Known Modules in WebMin (other modules were present there)

any ideas about this problem?

Regards
Deep
 
OP
Deep

Deep

Version 2.0
no man i am not able to slove it...
i have asked same question in couple of other forums also..but till now no satisfactory replies :(

Deep
 

drgrudge

Another Brick in the Wall
i am sure no soul will (like me!) will ever find out the solution....
man it is complicated... :wink:
 
OP
Deep

Deep

Version 2.0
i think if anyone knows linux and know stuff about apache configuration should be able to solve it pretty easily :)

Deep
 

drgrudge

Another Brick in the Wall
then why were u not able to solve?
dont tell me, that u know dont stuff about apache configuration and linux!
 

id10t

Broken In
i don't know much about apache but if webmin is saying that the module is loaded then most probably it is loaded. if you want to be double sure then get a tgz package of Slackware may be and extract the new mod_rewrite.so and mod_rewrite.o.
btw have you set any default domain on the server? it might be too trivial but i m asking this question as you didn't copy it in the part of your .httpd file. if you have not done it then try setting your VirtualHost directives to your local IP. like...
<VirtualHost xxx.xxx.xxx.xxx>
RewriteEngine on
RewriteRule id(.*)\.htm$ id.php?id=$1
</VirtualHost>
where xxx.xxx.xxx.xxx would obviously be your IP.
 
OP
Deep

Deep

Version 2.0
Hi,
Thanks for the help, i am gonna do this only in our server's httpd.conf but before that i have to get mod_rewrite working..

so thats the reason i added one test rule in .htaccess file, so it that works then the thing u said above also should work because both use same thing i.e. mod_rewrite.so

Regards
Deep
 

id10t

Broken In
yes both use the same thing but the problem could be that because of absence of any default domain the module is unable to locate the page. try putting the IP of your test machine as your default domain and check.
if you still have doubts about the module then you can also compile only mod_rewrite module by using apxs. have a look at this page
*forums.devshed.com/archive/t-123983
if it still doesn't work then try extracting modules from precompiled packages of some other distro or try installing rpm's.
 
OP
Deep

Deep

Version 2.0
Woha !!!! Finally, I got it wokring 8)

I still dont know what is wrong but when i added the rule in httpd.conf then it worked..

pretty strange

Code:
<VirtualHost 10.0.0.200>
    ServerAdmin root@localhost
    DocumentRoot /home/websites/tajonline
    ServerName dev.tajonline.com
    RewriteEngine On
    RewriteRule /press/id(.*)\.htm$ /press/id.php?id=$1
</VirtualHost>

anyways thanks for the help id10t

take care
Deep
 

id10t

Broken In
actually its not strange at all. you were starting the RewriteEngine in .htaccess and had not given any default domain to the server either. both of these things need to be done in httpd.conf which is the overall conf file for apache while .htaccess handles rules on per-directory basis.
its nice to know that you solved your problem though :)
 
OP
Deep

Deep

Version 2.0
id10t said:
actually its not strange at all. you were starting the RewriteEngine in .htaccess and had not given any default domain to the server either. both of these things need to be done in httpd.conf which is the overall conf file for apache while .htaccess handles rules on per-directory basis.
its nice to know that you solved your problem though :)

hi,
Default domain name was aleady there..and you know still things dont work with htaccess file.. i just added rewrite code in the previously added lines...i.e. in dev.tajonline.com vitrualhost block..

Regards
Deep
 
Status
Not open for further replies.
Top Bottom