You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Sebastian <se...@dslr.net> on 2003/04/05 12:29:16 UTC

[users@httpd] help with url rewrite.

hello,

I'd like to make my URL's seach engine friendly.

I would like to make /articles/comments.php?id=120

act as /articles/120

I have mod_rewrite installed, I searched and searched but found little help
on how to do this, I would like to use .htaccess if possible.

Thanks in advanced.

cheers,
- Sebastian



Re: [users@httpd] help with url rewrite.

Posted by Andrea Rossignoli <so...@polin.it>.
Hi,

another solution is:

/articles/.htaccess
#begin .htaccess

# Remove this line if this option is already enabled
Options +FollowSymLinks

RewriteEngine On

RewriteRule ^([0-9]+)/?$ comments.php?id=$1 [L]

#end .htaccess

It's important, as I said previously, that the .htaccess is located in the
articles directory.

The rules I wrote will take a care of the trailing slash that can be
optional,
it means that it will both work for /articles/120 and /articles/120/

:-) Andrea

----- Original Message -----
From: "Jurgen" <ap...@squarehosting.com>
To: <us...@httpd.apache.org>
Sent: Saturday, April 05, 2003 23:34
Subject: Re: [users@httpd] help with url rewrite.


> Hi,
>
> you could try something close to this. It might need some modifications
> to work in .htaccess
>
> RewriteCond ${REQUEST_URI} !^/articles/comments.php
> RewriteRule /articles/(.+) /articles/comments.php?id=$1
>
> Jurgen
>
> On Sat, 5 Apr 2003 15:35:07 -0500
> "Sebastian" <se...@dslr.net> wrote:
>
> > anyone?
> >   ---- Original Message -----
> >   From: Sebastian
> >
> >
> >   hello,
> >
> >   I'd like to make my URL's seach engine friendly.
> >
> >   I would like to make /articles/comments.php?id=120
> >
> >   act as /articles/120
> >
> >   I have mod_rewrite installed, I searched and searched but found
> little> help on how to do this, I would like to use .htaccess if
> possible.>
> >   Thanks in advanced.
> >
> >   cheers,
> >   - Sebastian
> >
> >
> >
>
> ---------------------------------------------------------------------
> 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


---------------------------------------------------------------------
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


Re: [users@httpd] help with url rewrite.

Posted by Jurgen <ap...@squarehosting.com>.
Hi,

you could try something close to this. It might need some modifications
to work in .htaccess

RewriteCond ${REQUEST_URI} !^/articles/comments.php
RewriteRule /articles/(.+) /articles/comments.php?id=$1

Jurgen

On Sat, 5 Apr 2003 15:35:07 -0500
"Sebastian" <se...@dslr.net> wrote:

> anyone?
>   ---- Original Message -----
>   From: Sebastian
> 
> 
>   hello,
> 
>   I'd like to make my URL's seach engine friendly.
> 
>   I would like to make /articles/comments.php?id=120
> 
>   act as /articles/120
> 
>   I have mod_rewrite installed, I searched and searched but found
little> help on how to do this, I would like to use .htaccess if
possible.> 
>   Thanks in advanced.
> 
>   cheers,
>   - Sebastian
> 
> 
> 

---------------------------------------------------------------------
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


Re: [users@httpd] help with url rewrite.

Posted by Sebastian <se...@dslr.net>.
anyone?
  ---- Original Message -----
  From: Sebastian


  hello,

  I'd like to make my URL's seach engine friendly.

  I would like to make /articles/comments.php?id=120

  act as /articles/120

  I have mod_rewrite installed, I searched and searched but found little
help on how to do this, I would like to use .htaccess if possible.

  Thanks in advanced.

  cheers,
  - Sebastian