You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by jo...@infoservices.in on 2012/09/17 12:36:12 UTC

[users@httpd] a complex .htaccess redirect question

Hello list,

How can I append .html in-between a link ?

For example  http://www.mydomain.com/en/page?artId=1234  should redirected to

http://www.mydomain.com/en/page.html?artId=1234

page1?artId=1234 needs to be redirected as page1.html?artId=1234

How can I achieve this through .htaccesss ?

I have already tested with

```````````````
RewriteRule ^page$ $1.html [L]
``````````````````

But no success !!!

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


Re: [users@httpd] a complex .htaccess redirect question

Posted by jo...@infoservices.in.
On Mon, 17 Sep 2012 13:05:38 +0200
Mathijs <ma...@gmail.com> wrote:

> If all you want is for  http://www.mydomain.com/en/page?artId=1234 to be
> handled by page.html, then enabling MultiViews might be a much easier
> solution then bringing in the beast that is mod_rewrite.
> 

I don't know if MultiViews is the exact solution for what I like to do.

My original link is http://www.mydomain.com/en/page?artId=1234

and I like to redirect it at 

http://www.mydomain.com/en/page.html?artId=1234

page?artId=1234 needs to be redirected as page.html?artId=1234

> MultiViews basically extends the requested URI to possible matches (content
> negotiation), if the initial request would result in a 404 error. For more
> information, see the MultiViews paragraph on this page
> https://httpd.apache.org/docs/current/content-negotiation.html#negotiation
> 
> On Mon, Sep 17, 2012 at 1:00 PM, <jo...@infoservices.in> wrote:
> 
> > On Mon, 17 Sep 2012 06:40:05 -0400
> > Eric Covener <co...@gmail.com> wrote:
> >
> > > On Mon, Sep 17, 2012 at 6:36 AM,  <jo...@infoservices.in> wrote:
> > > > Hello list,
> > > >
> > > > How can I append .html in-between a link ?
> > > >
> > > > For example  http://www.mydomain.com/en/page?artId=1234  should
> > redirected to
> > > >
> > > > http://www.mydomain.com/en/page.html?artId=1234
> > > >
> > > > page1?artId=1234 needs to be redirected as page1.html?artId=1234
> > > >
> > > > How can I achieve this through .htaccesss ?
> > > >
> > > > I have already tested with
> > > >
> > > > ```````````````
> > > > RewriteRule ^page$ $1.html [L]
> > >
> > > You need to capture something with () to use $1.
> > >
> > Thanks,
> >
> > Based on your suggestion, I have ttried with ? as per the the links. So
> > now the rule is
> >
> > RewriteRule ^page(?)$ $1.html [L]
> >
> > But the link still appears with out .html  like
> > http://www.mydomain.com/en/page?artId=1234
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> > For additional commands, e-mail: users-help@httpd.apache.org
> >
> >
> 
> 


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


Re: [users@httpd] a complex .htaccess redirect question

Posted by Mathijs <ma...@gmail.com>.
If all you want is for  http://www.mydomain.com/en/page?artId=1234 to be
handled by page.html, then enabling MultiViews might be a much easier
solution then bringing in the beast that is mod_rewrite.

MultiViews basically extends the requested URI to possible matches (content
negotiation), if the initial request would result in a 404 error. For more
information, see the MultiViews paragraph on this page
https://httpd.apache.org/docs/current/content-negotiation.html#negotiation

On Mon, Sep 17, 2012 at 1:00 PM, <jo...@infoservices.in> wrote:

> On Mon, 17 Sep 2012 06:40:05 -0400
> Eric Covener <co...@gmail.com> wrote:
>
> > On Mon, Sep 17, 2012 at 6:36 AM,  <jo...@infoservices.in> wrote:
> > > Hello list,
> > >
> > > How can I append .html in-between a link ?
> > >
> > > For example  http://www.mydomain.com/en/page?artId=1234  should
> redirected to
> > >
> > > http://www.mydomain.com/en/page.html?artId=1234
> > >
> > > page1?artId=1234 needs to be redirected as page1.html?artId=1234
> > >
> > > How can I achieve this through .htaccesss ?
> > >
> > > I have already tested with
> > >
> > > ```````````````
> > > RewriteRule ^page$ $1.html [L]
> >
> > You need to capture something with () to use $1.
> >
> Thanks,
>
> Based on your suggestion, I have ttried with ? as per the the links. So
> now the rule is
>
> RewriteRule ^page(?)$ $1.html [L]
>
> But the link still appears with out .html  like
> http://www.mydomain.com/en/page?artId=1234
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>


-- 
Gr,

Mathijs

Re: [users@httpd] a complex .htaccess redirect question

Posted by jo...@infoservices.in.
On Mon, 17 Sep 2012 06:40:05 -0400
Eric Covener <co...@gmail.com> wrote:

> On Mon, Sep 17, 2012 at 6:36 AM,  <jo...@infoservices.in> wrote:
> > Hello list,
> >
> > How can I append .html in-between a link ?
> >
> > For example  http://www.mydomain.com/en/page?artId=1234  should redirected to
> >
> > http://www.mydomain.com/en/page.html?artId=1234
> >
> > page1?artId=1234 needs to be redirected as page1.html?artId=1234
> >
> > How can I achieve this through .htaccesss ?
> >
> > I have already tested with
> >
> > ```````````````
> > RewriteRule ^page$ $1.html [L]
> 
> You need to capture something with () to use $1.
> 
Thanks,

Based on your suggestion, I have ttried with ? as per the the links. So now the rule is

RewriteRule ^page(?)$ $1.html [L]

But the link still appears with out .html  like  http://www.mydomain.com/en/page?artId=1234

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


Re: [users@httpd] a complex .htaccess redirect question

Posted by Eric Covener <co...@gmail.com>.
On Mon, Sep 17, 2012 at 6:36 AM,  <jo...@infoservices.in> wrote:
> Hello list,
>
> How can I append .html in-between a link ?
>
> For example  http://www.mydomain.com/en/page?artId=1234  should redirected to
>
> http://www.mydomain.com/en/page.html?artId=1234
>
> page1?artId=1234 needs to be redirected as page1.html?artId=1234
>
> How can I achieve this through .htaccesss ?
>
> I have already tested with
>
> ```````````````
> RewriteRule ^page$ $1.html [L]

You need to capture something with () to use $1.

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