CodeIgniter Forums
.htaccess "segment/query style" to "query only style" mapping problem - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: .htaccess "segment/query style" to "query only style" mapping problem (/thread-12385.html)



.htaccess "segment/query style" to "query only style" mapping problem - El Forum - 10-17-2008

[eluser]dorjeduck[/eluser]
Good morning folks,

hope all are well.

Justed started two days ago with codeigniter and I like it a lot so far. But at the moment I run into a problem which drives me nuts, hopefully some of you can help with that.

I want to pass an URL to my controller. I red several topics about that in this forum and decided to try to solve this by using query strings.

My incoming http requests looks like

Quote:http://goosebumps4all.net/w4you/related?yups=http://error.com/noerror&page=2
and
http://goosebumps4all.net/w4you/related.phtml?yups=http://error.com/noerror&page=2

So what I do in my .htaccess file is the following

Code:
RewriteRule ^related.phtml(.*) related$1
RewriteCond $1 ^related
RewriteRule ^related(.*) index.php=c=related$1 [L]

(The first line to get rid of the optional .phtml - I am sure that can be handled more clever))

That works so far but if I call

Quote:http://goosebumps4all.net/w4you/related?yups=http://error.com/noerror

without page query parameter I get an 404 Page not found error.


Would be great if someone can give me an hint what goes wrong here or can give me some advice how to handle the URL in URI issue more clever.


Thanks in advance

martin


.htaccess "segment/query style" to "query only style" mapping problem - El Forum - 10-17-2008

[eluser]dorjeduck[/eluser]
Oh

this went wrong in pretty every regards, sorry for everybody who took a look.

So let's forget that post, here comes what I do know and it works somehow


RewriteCond %{QUERY_STRING} yups=(.*)
RewriteRule ^related.*$ index.php?c=related&yups;=%1 [L]


It is still pretty crappy since it assume that the page parameter is specified after the yups parameter (%1 here also contains the page parameter if any) but in my case that is fine and I am done with htaccess for a while now I guess Wink


Cheers

martin