.jsp SEO friendly URL rewrites and redirections

Hi,

Hope you can help, a client of mine has a site with dynamically generated URL’s, I want to make the URL’s SEO friendly, clean them and rewrite them as new keyword rich URL’s and then redirect the old URL to the new.

I am trying to carry out some URL rewrites and redirections in .jsp on an apache server and I just cant figure it out.

To do this in php or html I would add the following code to the .htaccess file

RewriteCond %{THE_REQUEST} [1]+\ /old\.php\ HTTP/
RewriteRule ^old\.php$ http://www.exampler.co.uk/new/? [R=301,L]
RewriteRule new/$ old.php [L]

Which basically masks/ rewrites the old.php to new.php and at the same time redirects the old.php to the new.php. This works fine on the server for html files but not when I try it on their .jsp URLs.

I cant even get the basic rewrite/ mask working:

RewriteRule new/$ old.php [L]
However they are currently using the url_fw.conf’ to carry out some redirects.

The only mention of jsp in the http.conf file that could be affecting the JSP files is:

<IfDefine RESTRICT>

RewriteCond %{REQUEST_URI} !^/OA_HTML/oam/nonUix/launchMode/restricted/downtime.html
RewriteCond %{REQUEST_URI} !^/servlets/weboamLocal/.*
RewriteCond %{REQUEST_URI} !^/OA_HTML/cabo/.*
RewriteCond %{REQUEST_URI} !^/OA_MEDIA/.*
RewriteCond %{REQUEST_URI} !^/$
RewriteCond %{REQUEST_URI} !^/([^/]).htm(1)?
RewriteCond %{REQUEST_URI} !^/([^/])
.(gif|bmp|jpeg|jpg)
RewriteCond %{REQUEST_URI} !^/servlets/oracle\.jsp\.JspServlet.*
RewriteRule ^/(.)* /OA_HTML/oam/nonUix/launchMode/restricted/downtime.html [R,L]
</IfDefine>

Any help would be greatly appreciated.

Many Thanks,

Neil


  1. A-Z ↩︎

Tough question.

Without knowing the exact setup of your webapp or your environment…

Check to verify that the urls are indeed ending with .jsp. In theory java webapps aren’t suppose to go directly to .jsp files. But, if the webapp was poorly written, it might.

Are you sure that the calls to the jsps are going though the apache server? Do you see an explicit modjk or modproxy entry for the webapp that is serving the jsp files?