Page 1 of 1

Pretty URLs problem .

Posted: Mon Dec 21, 2009 12:53 pm
by voxberry
Hello pplz .

I'm trying to build a new website with cmsms 1.6.6 .. and I am trying to build a new function to read some custom databases and output some info .

I installed pretty URLS (.htaccess and config modrewrite) .

So now, http://www.site.com/index.php?page=home becomes http://www.site.com/home
   
The problem : at some point I have to pass some vars over the url, like :
    http://www.site.com/index.php?page=home ... r=somedata[/b]
and I wanna use some rewrite rules in .htaccess so the url will look like this :
    http://www.site.com/home/[b]SOMEDATA[/b]

And I can not figure it out . I have tryed a lot of combinations of rules and rewrite actions none work .

In my .htaccess file there is the defaul line :
        RewriteRule ^(.+)$ index.php?page=$1 [QSA]

what does NOT work for me :
        RewriteRule ^(.+)/(.+)/$ index.php?page=$1&myvar=$2 [NC,L]

Any help would be very useful ! THANKS .

Re: Pretty URLs problem .

Posted: Mon Dec 21, 2009 2:13 pm
by voxberry
the only thing that works is a combined link and that kinda sucks :

http://www.site.com/home/[b]?myvar=somedata[/b]

how do I make this go way ???

Re: Pretty URLs problem .

Posted: Mon Dec 21, 2009 7:50 pm
by voxberry
in the dark ... looking for the light ... still no way out .
i have tryed out many combinations of conditions and rulez, nothing works ....

I found a fix for the news rss with the htaccess . i tryed to do it like that, still, nothing ... it doesn;t work ...

Re: Pretty URLs problem .

Posted: Mon Dec 21, 2009 7:58 pm
by Dr.CSS
You may have to explain in more detail what and why your doing what your doing...

Re: Pretty URLs problem .

Posted: Mon Dec 21, 2009 9:07 pm
by voxberry
ok .
I will do just that .

I have a funtion that needs to $_GET a var over the URL, besides page var, so I know what to pull out of the database .
I have a custom database, besides the cms default stuff, and I will make links like :

http://www.site.com/index.php?page=home ... r=somedata[/b]

where MYVAR will be what I need from the database to be printed .

So besides the default htaccess line where : RewriteRule ^(.+)$ index.php?page=$1 [QSA] .
this and the config line with $config['use_hierarchy'] = true; you will get nice urls .

But I need a new rule as I have a custom new addition to the link : &myvar=somedata

Anyway ... I said this allready .
after many hours of learning about how to write htaccess rules and conditions, I ended up with this :

RewriteRule ^members/(.+)/$ members.html?myvar=$1   #--- myline
RewriteRule ^(.+)\.html$ index.php?page=$1 [QSA]  # --- default line from pretty urls

This almost works ... but not 100 % .
this still looks very twistted.