0

I have the domain domain.gr.

I have setup an Apache server with mod_rewrite and mod_jk.

<VirtualHost *:80>
    ServerName domain.gr
    ServerAlias www.domain.gr
    ServerAdmin "[email protected]"
    DocumentRoot /var/www

    <IfModule jk_module>
        JkMount /myapp/* worker1

        Alias /myapp "/opt/tomcat/webapps/myapp"

        <Directory "/opt/tomcat/webapps/myapp">
            Options Indexes FollowSymLinks
            Allow from all
        </Directory>

        <Location "/myapp/WEB-INF/">
            Deny from all
        </Location>
    </IfModule>
</VirtualHost>

All works fine but now i want to canonicalize the URLs.

I want when i type

domain.gr         -> www.domain.gr
domain.gr/myapp   -> www.domain.gr/myapp

I use the rules

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.domain\.gr [NC]
RewriteRule ^(.*)$ http://www.domain.gr$1 [L,R=301]

When i write domain.gr it goes to www.domain.gr, but when i write domain.gr/myapp it doesn't go to www.domain.gr/myapp

Any idea?

1 Answer 1

0

Where have you placed those rewrite rules? ie, are they within that block, or did you put them somewhere else? Perhaps in a .htaccess file?

What happens instead? ie, does it stay at domain.gr/myapp, or does something else happen?

If it's in a .htaccess file, $1 is going to be 'myapp' rather than '/myapp', resulting in a redirect to domain.grmyapp which of course doesn't exist.

1
  • i manage to solved it. I had those rules in httpd.conf but not in VirtualHost tag. When i move them on VirtualHost tag it worked Jun 18, 2013 at 15:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .