LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   mod_rewrite not redirecting (https://www.linuxquestions.org/questions/linux-server-73/mod_rewrite-not-redirecting-657886/)

t0bias 07-24-2008 03:30 AM

mod_rewrite not redirecting
 
Hi,

I'm trying to redirect

wiki.foo.com ---> http://www.foo.com/moinwiki

therefore I added this to my httpd.conf:
Code:

<VirtualHost _default_:80>
    RewriteEngine on
    RewriteLog "/var/log/apache/rewrite.log"
    RewriteLogLevel 9

    RewriteRule ^wiki(.*)$ http://www.foo.com/moinwiki [R]
</VirtualHost>

in the rewrite.log I get:

Code:

[24/Jul/2008:10:24:56 +0200] [www.foo.com/sid#80c3974][rid#80b3c6c/initial] (2) init rewrite engine with requested uri /moinwiki
10.0.10.61 - - [24/Jul/2008:10:24:56 +0200] [www.foo.com/sid#80c3974][rid#80b3c6c/initial] (3) applying pattern '^wiki(.*)$' to uri '/moinwiki'
10.0.10.61 - - [24/Jul/2008:10:24:56 +0200] [wwwfoo.com/sid#80c3974][rid#80b3c6c/initial] (1) pass through /moinwiki

but I get www.foo.com instead of www.foo.com/moinwiki.

Can anyone help me?

Thanks,

BlueC 07-24-2008 06:29 AM

You need a virtualhost for wiki.foo.com as follows:

Code:

<VirtualHost _default_:80>
    ServerName wiki.foo.com
    RewriteEngine on
    RewriteRule ^(.*)$ http://www.foo.com/moinwiki [R]
</VirtualHost>

(wiki.foo.com must be in the foo.com DNS zone file for this to work)

Clearly you then need another virtualhost to host the www.foo.com domain.

t0bias 07-25-2008 04:53 AM

Thanks for your answer,
I did as advised, but the result is still the same....


All times are GMT -5. The time now is 09:52 PM.