You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Charan <ch...@gmail.com> on 2010/05/03 20:46:51 UTC

[users@httpd] redirecting to index.jsp using rewrite rules

Hi,

I'm using the below rule to redirect to index.jsp if user doesn't add
index.jsp to the url. Is it possible to have one rule instead of the below
repeating rule.

RewriteEngine On
RewriteCond %{REQUEST_URI} /en/[a-z]*/$
RewriteCond %{REQUEST_URI} !\.jsp$
RewriteRule ^(.*)$ $1index.jsp [R=301,L]
RewriteCond %{REQUEST_URI} /en/[a-z]*/[a-z]*_?[a-z]*/$
RewriteCond %{REQUEST_URI} !\.jsp$
RewriteRule ^(.*)$ $1index.jsp [R=301,L]


Thanks,
Charan

Re: [users@httpd] redirecting to index.jsp using rewrite rules

Posted by alin vasile <al...@yahoo.com>.
DirectoryIndex index.jsp ?



________________________________
From: Charan <ch...@gmail.com>
To: users@httpd.apache.org
Sent: Mon, May 3, 2010 9:46:51 PM
Subject: [users@httpd] redirecting to index.jsp using rewrite rules

Hi, 

I'm using the below rule to redirect to index.jsp if user doesn't add index.jsp to the url. Is it possible to have one rule instead of the below repeating rule.

RewriteEngine On
RewriteCond %{REQUEST_URI} /en/[a-z]*/$
RewriteCond %{REQUEST_URI} !\.jsp$
RewriteRule ^(.*)$ $1index.jsp [R=301,L]
RewriteCond %{REQUEST_URI} /en/[a-z]*/[a-z]*_?[a-z]*/$
RewriteCond %{REQUEST_URI} !\.jsp$
RewriteRule ^(.*)$ $1index.jsp [R=301,L]


Thanks,
Charan


      

Re: [users@httpd] Re: redirecting to index.jsp using rewrite rules

Posted by Charan <ch...@gmail.com>.
Thank you,
this worked for me


On Mon, May 3, 2010 at 12:10 PM, Dan Poirier <po...@pobox.com> wrote:

> On 2010-05-03 at 14:46, Charan <ch...@gmail.com> wrote:
>
> > Hi,
> >
> > I'm using the below rule to redirect to index.jsp if user doesn't add
> > index.jsp to the url. Is it possible to have one rule instead of the
> below
> > repeating rule.
> >
> > RewriteEngine On
> > RewriteCond %{REQUEST_URI} /en/[a-z]*/$
> > RewriteCond %{REQUEST_URI} !\.jsp$
> > RewriteRule ^(.*)$ $1index.jsp [R=301,L]
> > RewriteCond %{REQUEST_URI} /en/[a-z]*/[a-z]*_?[a-z]*/$
> > RewriteCond %{REQUEST_URI} !\.jsp$
> > RewriteRule ^(.*)$ $1index.jsp [R=301,L]
>
> Why not
>
> RewriteEngine On
> RewriteRule ^(.*/)$ $1index.jsp [R=301,L]
>
>
> ---------------------------------------------------------------------
> 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@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

[users@httpd] Re: redirecting to index.jsp using rewrite rules

Posted by Dan Poirier <po...@pobox.com>.
On 2010-05-03 at 14:46, Charan <ch...@gmail.com> wrote:

> Hi,
>
> I'm using the below rule to redirect to index.jsp if user doesn't add
> index.jsp to the url. Is it possible to have one rule instead of the below
> repeating rule.
>
> RewriteEngine On
> RewriteCond %{REQUEST_URI} /en/[a-z]*/$
> RewriteCond %{REQUEST_URI} !\.jsp$
> RewriteRule ^(.*)$ $1index.jsp [R=301,L]
> RewriteCond %{REQUEST_URI} /en/[a-z]*/[a-z]*_?[a-z]*/$
> RewriteCond %{REQUEST_URI} !\.jsp$
> RewriteRule ^(.*)$ $1index.jsp [R=301,L]

Why not

RewriteEngine On
RewriteRule ^(.*/)$ $1index.jsp [R=301,L]


---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org