htaccess rewrite help

htaccess rewrite help

am 17.10.2007 22:49:12 von giloosh99

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

Re: htaccess rewrite help

am 17.10.2007 23:14:57 von -Lost

Response from giloosh :

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

Re: htaccess rewrite help

am 18.10.2007 18:38:00 von Thomas Mlynarczyk

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)

Re: htaccess rewrite help

am 18.10.2007 19:00:22 von giloosh99

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

Re: htaccess rewrite help

am 18.10.2007 22:59:04 von Thomas Mlynarczyk

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)