You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by aparna Puram <ap...@gmail.com> on 2015/08/05 17:25:49 UTC

[users@httpd] Help with rewrite rules

Hello All,

I have specific requirement for a rewirte rule.


http://localhost/inservice has to be rewrited to http://localhost/InSerivce.

Only the first and 3rd letter has to be caps..and rest all have to be lower
case. Even if user gives Inservice, it will still have to rewite it to
InService.

Request you to help me with this.

-- 
Regards,
Aparna Puram
+919449473709

Re: [users@httpd] Help with rewrite rules

Posted by Eric Covener <co...@gmail.com>.
On Wed, Aug 5, 2015 at 11:38 AM, , , <us...@gmail.com> wrote:
> RewriteRule ^/inservice$ /InService [R=301,L,NC]


Seems like it would loop with NC.

-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Help with rewrite rules

Posted by ", ," <us...@gmail.com>.
Woops you guys are right thanks for catching that loop.

Another option if you can't use RewriteConds for some reason is below
is using the skip flag:
http://httpd.apache.org/docs/2.4/rewrite/flags.html#flag_s

RewriteRule ^/InService$ - [S=1]
RewriteRule ^/inservice$ /InService [R=301,L,NC]

On Wed, Aug 5, 2015 at 10:48 AM, Macks, Aaron
<am...@harvardbusiness.org> wrote:
> Actually i think that will create a rewrite loop, since it’ll match
> “InService’ and replace it with InService
>
> I’d add this
> RewriteCond %{REQUEST_URI}  !^/InService
>
> above the same RewriteRule
>
>
> On Aug 5, 2015, at 11:38 AM, , , <us...@gmail.com> wrote:
>
> If this is only for the word inservice then you can do a basic rule
> using the No Case flag in apache
> http://httpd.apache.org/docs/2.4/rewrite/flags.html#flag_nc
>
> RewriteRule ^/inservice$ /InService [R=301,L,NC]
>
>
> The user can enter any combination of upper or lower and the rule will
> still fire as the NC flag makes the rule function for any case.
>
> On Wed, Aug 5, 2015 at 10:25 AM, aparna Puram <ap...@gmail.com> wrote:
>
> Hello All,
>
> I have specific requirement for a rewirte rule.
>
>
> http://localhost/inservice has to be rewrited to http://localhost/InSerivce.
>
> Only the first and 3rd letter has to be caps..and rest all have to be lower
> case. Even if user gives Inservice, it will still have to rewite it to
> InService.
>
> Request you to help me with this.
>
> --
> Regards,
> Aparna Puram
> +919449473709
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
> --
> Aaron Macks
> Systems Architect
>
> Harvard Business Publishing
> 300 North Beacon St.    |   Watertown, MA 02472
> (617) 783-7461                |   Fax: (617) 783-7467
> www.harvardbusiness.org |   Cell:(978) 317-3614
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Help with rewrite rules

Posted by "Macks, Aaron" <am...@harvardbusiness.org>.
Actually i think that will create a rewrite loop, since it’ll match “InService’ and replace it with InService

I’d add this
RewriteCond %{REQUEST_URI}  !^/InService

above the same RewriteRule


On Aug 5, 2015, at 11:38 AM, , , <us...@gmail.com>> wrote:

If this is only for the word inservice then you can do a basic rule
using the No Case flag in apache
http://httpd.apache.org/docs/2.4/rewrite/flags.html#flag_nc

RewriteRule ^/inservice$ /InService [R=301,L,NC]


The user can enter any combination of upper or lower and the rule will
still fire as the NC flag makes the rule function for any case.

On Wed, Aug 5, 2015 at 10:25 AM, aparna Puram <ap...@gmail.com> wrote:
Hello All,

I have specific requirement for a rewirte rule.


http://localhost/inservice has to be rewrited to http://localhost/InSerivce.

Only the first and 3rd letter has to be caps..and rest all have to be lower
case. Even if user gives Inservice, it will still have to rewite it to
InService.

Request you to help me with this.

--
Regards,
Aparna Puram
+919449473709

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


--
Aaron Macks
Systems Architect

Harvard Business Publishing
300 North Beacon St.    |   Watertown, MA 02472
(617) 783-7461                |   Fax: (617) 783-7467
www.harvardbusiness.org<http://www.harvardbusiness.org> |   Cell:(978) 317-3614


Re: [users@httpd] Help with rewrite rules

Posted by ", ," <us...@gmail.com>.
If this is only for the word inservice then you can do a basic rule
using the No Case flag in apache
http://httpd.apache.org/docs/2.4/rewrite/flags.html#flag_nc

RewriteRule ^/inservice$ /InService [R=301,L,NC]


The user can enter any combination of upper or lower and the rule will
still fire as the NC flag makes the rule function for any case.

On Wed, Aug 5, 2015 at 10:25 AM, aparna Puram <ap...@gmail.com> wrote:
> Hello All,
>
> I have specific requirement for a rewirte rule.
>
>
> http://localhost/inservice has to be rewrited to http://localhost/InSerivce.
>
> Only the first and 3rd letter has to be caps..and rest all have to be lower
> case. Even if user gives Inservice, it will still have to rewite it to
> InService.
>
> Request you to help me with this.
>
> --
> Regards,
> Aparna Puram
> +919449473709

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Help with rewrite rules

Posted by Richard <li...@listmail.innovate.net>.

> Date: Wednesday, August 05, 2015 20:55:49 +0530
> From: aparna Puram <ap...@gmail.com>
>
> Hello All,
> 
> I have specific requirement for a rewirte rule.
> 
> 
> http://localhost/inservice has to be rewrited to
> http://localhost/InSerivce.
> 
> Only the first and 3rd letter has to be caps..and rest all have to
> be lower case. Even if user gives Inservice, it will still have to
> rewite it to InService.
> 
> Request you to help me with this.

You may want to look at the redirect and redirectmatch directives:

  <http://httpd.apache.org/docs/2.4/rewrite/avoid.html>

  <http://httpd.apache.org/docs/2.4/mod/mod_alias.html#redirect>

as they are better for the simple redirection that you are,
seemingly, asking for.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org