Enabling htaccess in local tomcat install

2,905 views
Skip to first unread message

ML

unread,
Aug 31, 2011, 5:55:14 AM8/31/11
to Railo
Hi,

I installed Railo on Tomcat 7 on top of Apache 2.2 on my laptop
running Windows Vista. Apache runs on port 80, and Tomcat on port
8080.

Everything works ok, except now I am trying to do mod rewrite via
htaccess file. I created a simple rule to forward oldFile.htm to
newFile.htm.

When I visit http://mysite:80/oldFile.htm, it correctly pulls
newFile.htm. So I know that there is nothing wrong with the htaccess
file or the httpd.conf setting. However, when I go to http://mysite:8080/oldFile.htm,
the tomcat server is giving a 404 status. It doesn't seem to read the
htaccess file.

Any idea of what I did wrong? I spent hours trying out different
things and searching the web, but couldn't figure it out. I did
manage to get htaccess working on our live server that runs linux
(ubuntu).

Thank you.

Todd Rafferty

unread,
Aug 31, 2011, 6:17:31 AM8/31/11
to ra...@googlegroups.com
The rewrite is in apache (port 80), not tomcat. Tomcat (port 8080) has no idea of what the rewrite rules are and doesn't care.

Why are you port switching?
--
~Todd Rafferty
Volunteer
Community Manager
Railo Server - Open Source
----

ML

unread,
Aug 31, 2011, 9:17:36 AM8/31/11
to Railo
Maybe I am not setting this up right, but in order to call .cfm file I
have to use port 8080 (where tomcat is), no?

Is it then possible to use htaccess so I can do rewrite url (eg.
mysite:8080/index to point to mysite:8080/index.cfm)?

Thanks,
ML

On Aug 31, 6:17 am, Todd Rafferty <t...@getrailo.org> wrote:
> The rewrite is in apache (port 80), not tomcat. Tomcat (port 8080) has no
> idea of what the rewrite rules are and doesn't care.
>
> Why are you port switching?
>
>
>
>
>
>
>
>
>
> On Wed, Aug 31, 2011 at 5:55 AM, ML <min.c....@gmail.com> wrote:
> > Hi,
>
> > I installed Railo on Tomcat 7 on top of Apache 2.2 on my laptop
> > running Windows Vista.  Apache runs on port 80, and Tomcat on port
> > 8080.
>
> > Everything works ok, except now I am trying to do mod rewrite via
> > htaccess file.  I created a simple rule to forward oldFile.htm to
> > newFile.htm.
>
> > When I visithttp://mysite:80/oldFile.htm, it correctly pulls
> > newFile.htm.  So I know that there is nothing wrong with the htaccess
> > file or the httpd.conf setting.  However, when I go to
> >http://mysite:8080/oldFile.htm,
> > the tomcat server is giving a 404 status.  It doesn't seem to read the
> > htaccess file.
>
> > Any idea of what I did wrong?  I spent hours trying out different
> > things and searching the web, but couldn't figure it out.  I did
> > manage to get htaccess working on our live server that runs linux
> > (ubuntu).
>
> > Thank you.
>
> --
> ~Todd Rafferty*
> Volunteer** *Community Manager

Todd Rafferty

unread,
Aug 31, 2011, 10:33:06 AM8/31/11
to ra...@googlegroups.com
No.

You have a couple of different routes here, mod_proxy or mod_ajp. You need to decide which way you want to go. Your code should not be calling port 8080, at all. Nor should you be linking to it.

I use mod_proxy, in my apache httpd.conf, I have this:


<Proxy *>
Allow from 127.0.0.1 </Proxy>
ProxyPreserveHost On ProxyPassMatch ^/(.+\.cf[cm])(/.*)?$ ajp://localhost:8009/$1$2
<VirtualHost *:80>
ServerName testhost1
DocumentRoot "C:\Dev\websites\testhost1"
DirectoryIndex index.html
ErrorLog "logs/testhost1-error.log"
CustomLog "logs/testhost1-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerName testhost2
DocumentRoot "C:\Dev\websites\testhost2"
DirectoryIndex index.html
ErrorLog "logs/testhost2-error.log"
CustomLog "logs/testhost2-access.log" common
</VirtualHost>

ML

unread,
Sep 1, 2011, 9:10:46 AM9/1/11
to Railo
Hi Todd,

Thanks for your help. I followed your blog entry in setting up my
railo with tomcat on windows, but I think I must not have done the
httpd.conf setting correctly. What I am not able to do is to redirect
http://mysite/index.cfm to http://mysite:8080/index.cfm. I tried
pasting your <Proxy> setting code above into my httpd.conf but I got
an error when I restarted apache. Sorry, I'd never done my own apache
install (coming from ACF). I will play around with the settings
again.

ML

Todd Rafferty

unread,
Sep 1, 2011, 9:47:39 AM9/1/11
to ra...@googlegroups.com
Did you uncomment mod_proxy? Look for mod_proxy in the httpd.conf and uncomment it by removing the # in front of it.
--
~Todd Rafferty
Volunteer
Community Manager
Reply all
Reply to author
Forward
0 new messages