Forum Moderators: phranque
Welcome to WebmasterWorld!
> but it does not work where my site is hosted.
Please post your relevant .htaccess code and define "does not work". Otherwise, all replies will be guesses.
Do you get a 500-Server Error response to requests with your code in place? If so, what's in the server error log?
Or does it appear that nothing happens at all?
Have you tried a simple test -- for example, rewriting a non-existent page to your home page, like
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^test\.html$ /index.html [L]
Jim
The administrator of the site in question seems to be saying Tomcat cannot handle 301 redirects, which I think is correct.
But, Tomcat is running within Apache and Apache can handle 301 redirects from .htaccess, so my question is:
Will Apache handle the redirect before passing the request on to Tomcat?
Has anyone out there successfully used .htaccess in an Apache/Tomcat setup?
Thanks
Thanks for the reply it's appreciated. I just re-read my reply and I have to say it looks a bit short and abrupt and a little rude.
I'm sorry, it wasn't meant to be, it's just that I'm juggling 10 things at once...
Anyway...
It was some time ago but I just got the old page, no error and no redirect.
The .htaccess was like this:
redirect 301 /old_page.htm [mydomain.co.uk...]
As for this lot:
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^test\.html$ /index.html [L]
I don't really know anything about Apache so you've lost me. I develop using Tomcat standalone and it's only when I deploy that Apache enters the scene.
So please look to the message above for the actual question.
Regards
On Apache2.0, there is some kind of priority system in place, as opposed to using the load order, and I can't claim to know anything about it.
Most of the people who post replies here are busy, so we understand.
Jim
This is the reply from the hosting guy, he seems to be sure that 301 redirect do not work when using both Apache and Tomcat.
Other people must have come up against this problem, it's probably the most common web server setup around...
You can to see all mod_alias directives at [httpd.apache.org...]
I have been trying to use Redirect directive with .htaccess on your site. No success because Apache forward request to Tomcat-Apache connector and request processed by Tomcat. I’m sure same effect will be with Alias directive because it processed by same Apache module.
Please look to Apache directives that configure Apache-Tomcat forwarding:
<Location "/context">
RemoveHandler .html
JkUriSet group tomcat4
</Location>
When Apache receive any request matched to /context, this request forwarded to Apache-Tomcat connector without any next handling by Apache. Usage of Redirect may be possible, for example, if you need to redirect any other path that not matched with Apache-Tomcat forwarding path - /anypath
One way is possible in your cause – processing by Tomcat.
Please look to Struts service documentation. Possible Struts could be configured to process these redirects. Please reply with Struts possibility for this configuration.
Anyone else want to chip in?
Regards
Lyndon