Url rewrite and Tomcat

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
I work for a web factory.
We have many sites made with jsp pages, so we have Apache and Tomcat working together.
For these sites we put rules like this in httpd.conf:
RewriteRule ^/folder/([^/]+)_language/([^/]+)_([^/]+)/([^/]+)_([^/]+)\.html /folder/my_page.jsp?sez=$2&pag=$4 [R,L] This rule works fine but a SEO Agency told us that it is better not to do the redirect and mantain the friendly url. At first it seemed simple, in fact all you have to do is remove the "R" option from the rule.
But if we do so we get an error.
If you are calling
http://www.my_site.com/folder/1_language/90_Products/126_Product.html
you get this error:


 HTTP Status 404 - /folder/1_language/90_Products/126_Product.html

------------------------------------------------------------------------

*type* Status report

*message* _/folder/1_language/90_Products/126_Product.html_

*description* _The requested resource (/folder/1_language/90_Products/126_Product.html) is not available._

------------------------------------------------------------------------


     Apache Tomcat/5.5.25


As you can see it seems like Apache passes the command to Tomcat but instead of telling it to use /folder/my_page.jsp?sez=90&pag=126 it passes /folder/1_language/90_Products/126_Product.html
which Tomcat cannot find.


This is the VirtualHost definition:

<VirtualHost *:80>
ServerName     www.my_site.com
ServerAlias     my_site.com
DocumentRoot "C:/Programmi/Apache Software Foundation/Tomcat 5.5/webapps/main_folder"

JkMount     /main_folder/*.jsp worker1
JkMount     /* worker1

RewriteEngine on

RewriteRule ^/folder/([^/]+)_language/([^/]+)_([^/]+)/([^/]+)_([^/]+)\.html /folder/my_page.jsp?sez=$2&pag=$4 [L]

RewriteLog logs/rewrite.log
RewriteLogLevel 9

ErrorLog logs/site_error_log
CustomLog logs/site_access_log common
</VirtualHost>


And this is the rewrite log file:
(2) init rewrite engine with requested uri /folder/1_language/90_Products/126_Product.html (3) applying pattern ^/folder/([^/]+)_language/([^/]+)_([^/]+)/([^/]+)_([^/]+)\.html to uri '/folder/1_language/90_Products/126_Product.html' (2) rewrite /folder/1_language/90_Products/126_Product.html -> /folder/my_page.jsp?sez=90&pag=126 (3) split uri=/folder/my_page.jsp?sez=90&pag=126 -> uri=/folder/my_page.jsp, args=sez=90&pag=126
(2) local path result: /folder/my_page.jsp
(2) prefixed with document_root to C:/Programmi/Apache Software Foundation/Tomcat 5.5/webapps/main_folder/folder/my_page.jsp (1) go-ahead with C:/Programmi/Apache Software Foundation/Tomcat 5.5/webapps/helvetia/public/helvetia.jsp [OK]


Any help appreciated.

Bye


--

Alessandro Fantuzzi - O-one s.r.l.
E-mail: fantuzzi@xxxxxxxxx <mailto:fantuzzi@xxxxxxxxx>
Software developer

www.o-one.net <http://www.o-one.net>

-------------------------------------------------------------------
Via Dante Zanichelli, 61 - 42100 Reggio Emilia
Tel. 0522 930078 - Fax. 0522 387947
-------------------------------------------------------------------
Via Stendhal, 36 - 20144 Milano
Tel 02.42292057 - Fax 02.47770936
-------------------------------------------------------------------

STRICTLY PERSONAL AND CONFIDENTIAL This message may contain confidential and proprietary material for the sole use of the intended recipient. Any review or distribution by others is strictly prohibited. If you are not the intended recipient please contact the sender and delete all copies. The contents of this message that do not relate to the official business of our company shall be understood as neither given nor endorsed by it.
-------------------------------------------------------------------

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux