LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   mod_rewrite doen't work in apache (https://www.linuxquestions.org/questions/linux-server-73/mod_rewrite-doent-work-in-apache-935948/)

Felipe 03-22-2012 06:02 PM

mod_rewrite doen't work in apache
 
hallo:

I'm trying to use mod_rewrite in apache 2.2.

My rule is very easy:
write 'a.html' and rewrite to '/folder1/alta.html'.

What I've added to httpd.conf

Quote:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteLog /opt/apache22/logs/rewrite.log
RewriteLogLevel 9

RewriteRule ^/a\.html$ /folder1/alta.html
</IfModule>
The file exists:
Quote:

# ls -l /opt/apache22/htdocs/folder1/alta.html
-rw-r--r-- 1 root root 10 mar 21 23:03 /opt/apache22/htdocs/folder1/alta.html
But if i type in Firefox:
http://curso3.curso.red/a.html

next message is displayed:
Quote:

..
The connection to the server was reset while the page was loading.
..
And log is:
Quote:

==> error_log <==
[Thu Mar 22 23:48:29 2012] [notice] child pid 5090 exit signal Segmentation fault (11)

==> rewrite.log <==
192.168.1.183 - - [22/Mar/2012:23:48:29 +0100] [curso3.curso.red/sid#8492a18][rid#85ac4c8/initial] (2) init rewrite engine with requested uri /a.html
192.168.1.183 - - [22/Mar/2012:23:48:29 +0100] [curso3.curso.red/sid#8492a18][rid#85ac4c8/initial] (3) applying pattern '^/a\.html$' to uri '/a.html'
192.168.1.183 - - [22/Mar/2012:23:48:29 +0100] [curso3.curso.red/sid#8492a18][rid#85ac4c8/initial] (2) rewrite '/a.html' -> '/folder1/alta.html'
192.168.1.183 - - [22/Mar/2012:23:48:29 +0100] [curso3.curso.red/sid#8492a18][rid#85ac4c8/initial] (2) local path result: /folder1/alta.html
192.168.1.183 - - [22/Mar/2012:23:48:29 +0100] [curso3.curso.red/sid#8492a18][rid#85ac4c8/initial] (2) prefixed with document_root to /opt/apache22/htdocs/folder1/alta.html
192.168.1.183 - - [22/Mar/2012:23:48:29 +0100] [curso3.curso.red/sid#8492a18][rid#85ac4c8/initial] (1) go-ahead with /opt/apache22/htdocs/folder1/alta.html [OK]

Of course, If I type the full path, it works:

Whats wrong? Why do I receive the signal segmentation fault and can't display the page?

Thanks

eeekster 03-22-2012 06:17 PM

Does it work if you add [L] to the rewrite rule?

Felipe 03-23-2012 06:56 PM

Hello:

I've also tried with [L] and the problem is the same.

I can't understand why doesn't work. It's an easy sample... No sure but I think that rewrite isn't working, but don't know why.

Any other suggestion?

Thanks

eeekster 03-23-2012 09:03 PM

Well, since it's getting a segfault I'd say the problem is most likely a but in httpd. Try a new version and see if that fixes the problem.

Felipe 03-24-2012 04:40 PM

Now I've downloaded and installed Apache 2.4.1 and it works fine.

But I think the problem was another. At first, the rewrite worked. But has stopped working when I've compiled the mod_jk for connection to tomcat.

The mod_jk release 1.2.33 I downloaded first has a problem as can be read in:
http://tomcat.apache.org/connectors-doc/

So I've downloaded 1.2.32 and everything works fine (at least the previous sample works in Apache 2.4.1 with mod_jk enabled).

For compiling 1.2.32 with Apache 2.4.1 there is a problem with make, which can be solved following this link (it talks about jk2-4, but has solved my problem with jk 1.2.32:
http://dev.portalaces.com/null/compi...on-apache-2-4/

Thanks for the help

eeekster 03-24-2012 06:19 PM

Quote:

Originally Posted by Felipe (Post 4635355)
Not sure if I've made any mistake...

I don't think you did.


All times are GMT -5. The time now is 07:04 PM.