www.mysite.com/bla.php?lng=bla.php ?!?!

Discuss practical ways rearrange URLs using mod_rewrite.

www.mysite.com/bla.php?lng=bla.php ?!?!

Postby Chris » Fri Jan 03, 2003 7:44 am

I have a script...
bla.php which does some languages thingies...
bla.php?lng=EN gives me the english page..
bla.php?lng=NL gives me the dutch page...

When using mod-rewrite...as below I have some troubles...

Code: Select all
RewriteEngine on
RewriteRule ^fsb/(.*)$ fsb/bla.php?lng=$1


when I type...
http://www.mysite.com/fsb/EN/
I expect it to rewrite it as www.mysite.com/bla.php?lng=EN
but it is actually rewriting it as...www.mysite.com/bla.php?lng=bla.php

Any help is appreciated!
Chris
 

Match more specifically

Postby andrewf » Tue Jan 21, 2003 1:52 pm

Lemme see... I believe that mod_rewrite keeps rewriting til it can't rewrite no more... Try limiting what you're matching:

Code: Select all
RewriteEngine on
RewriteRule ^fsb/(..) fsb/bla.php?lng=$1
#Only matches two-character language code, not 7-char "bla.php"

or...
Code: Select all
RewriteEngine on
RewriteCond $1 !=bla.php
RewriteRule ^fsb/(.*) fsb/bla.php?lng=$1
#Explicitly refuses to rematch "bla.php"
andrewf
 
Posts: 2
Joined: Tue Jan 21, 2003 1:51 pm

Postby Guest » Thu Feb 20, 2003 9:17 pm

you made little mistake
fixen version
Code: Select all
RewriteEngine on
RewriteRule ^fsb/(.*)$ bla.php?lng=$1
Guest
 


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 45 guests

cron