Forum Moderators: phranque

Message Too Old, No Replies

htaccess rewrite rule

         

jouno

6:00 am on Mar 15, 2004 (gmt 0)

10+ Year Member



Hello,

I'd like to refer to p.php?id=testid&dir=testdir&lang=testlang as
/testlang/testdir/testid

Can anyone tell me what's wrong about this htaccess- file.
I spend quite a lot of time trying different possibilities but all I ever got was an "404"-error.

Options +FollowSymLinks
RewriteEngine on
RewriteBase /full/path/to/
RewriteRule ^/(\.*)/(\.*)/(\.*)$ p.php?id=$3&dir=$2&lang=$1 [T=application/x-httpd-php]

Yours, Jouno

[edited by: jouno at 6:24 am (utc) on Mar. 15, 2004]

dcrombie

9:40 am on Mar 15, 2004 (gmt 0)



When you use \. you're looking for a literal '.' instead of a wild-card. Drop the '\'s and it should work.

jouno

10:52 am on Mar 15, 2004 (gmt 0)

10+ Year Member



Thanks for your answer.

I dropped the '\'s but it still doesn't work.

Do you have any more suggestions? Maybe I have to change the RewriteBase? I set the full server path to the folder my php document is in...

Sincerely, Jouno

DoppyNL

11:00 am on Mar 15, 2004 (gmt 0)

10+ Year Member



It looks like you want all requests done with the path

/full/path/to/

to be redirected to that script.

Why don't you sent

/full/path/to/*

to p.php
and then use some php-code to parse the actual request to parameters?!?

from the top of my head:

RewriteEngine on
RewriteRule ^/full/path/to/.*$ p.php

should redirect all requests made in that path to p.php
then you can use $_SERVER['REQUEST_URI'] to determine what to display.

elguiri

11:02 am on Mar 15, 2004 (gmt 0)

10+ Year Member Top Contributors Of The Month



Try this:

RewriteEngine On
RewriteRule ^/([^/]+)/([^/]+)/([^/]+)$ /p.php?id=$3&dir=$2&lang=$1 [L]