htaccess rewrite help

any ideas on how i can use .htaccess to rewrite a link with letters
and underscores into link.php

for example rewrite:

http://domain/link_one

to:

http://domain/link_one.php

i spent hours trying to figure it out, and i couldn't get it. if you
have a way please let me know.
thanks,
gil
giloosh99 [ Mi, 17 Oktober 2007 22:49 ] [ ID #1847250 ]

Re: htaccess rewrite help

Response from giloosh <giloosh99 [at] gmail.com>:

> for example rewrite:
> http://domain/link_one
> to:
> http://domain/link_one.php
>
> i spent hours trying to figure it out, and i couldn't get it. if
> you have a way please let me know.

What have you got so far? I'll gladly help you figure it out.

--
-Lost
Remove the extra words to reply by e-mail. Don't e-mail me. I am
kidding. No I am not.
-Lost [ Mi, 17 Oktober 2007 23:14 ] [ ID #1847252 ]

Re: htaccess rewrite help

Also sprach giloosh:

> for example rewrite:
> http://domain/link_one
> to:
> http://domain/link_one.php


For example:

RewriteEngine On
RewriteRule ^(.+)$ $1.php [QSA]

But some modifications will be necessary, as the above will append ".php" to
absolutely everything.

Greetings,
Thomas

--
C'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison!
(Coluche)
Thomas Mlynarczyk [ Do, 18 Oktober 2007 18:38 ] [ ID #1848221 ]

Re: htaccess rewrite help

thanks for your help.
i have this:

RewriteEngine On
RewriteRule ^([a-z_]+)$ $1.php [NC]

i want only words with underscores to be effected

On Oct 18, 12:38 pm, "Thomas Mlynarczyk" <tho... [at] mlynarczyk-
webdesign.de> wrote:
> Also sprach giloosh:
>
> > for example rewrite:
> >http://domain/link_one
> > to:
> >http://domain/link_one.php
>
> For example:
>
> RewriteEngine On
> RewriteRule ^(.+)$ $1.php [QSA]
>
> But some modifications will be necessary, as the above will append ".php"=
to
> absolutely everything.
>
> Greetings,
> Thomas
>
> --
> C'est pas parce qu'ils sont nombreux =E0 avoir tort qu'ils ont raison!
> (Coluche)
giloosh99 [ Do, 18 Oktober 2007 19:00 ] [ ID #1848222 ]

Re: htaccess rewrite help

Also sprach giloosh:

> RewriteEngine On
> RewriteRule ^([a-z_]+)$ $1.php [NC]

> i want only words with underscores to be effected

Your above rule would also match words without underscores.

This would match words with at least one underscore:
^([a-z_]*_[a-z_]*)$

Greetings,
Thomas

--
C'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison!
(Coluche)
Thomas Mlynarczyk [ Do, 18 Oktober 2007 22:59 ] [ ID #1848227 ]
Webserver » alt.apache.configuration » htaccess rewrite help

Vorheriges Thema: Why are these modules built into httpd?
Nächstes Thema: Reverse Proxy Translations