• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
.htaccess "segment/query style" to "query only style" mapping problem

#1
[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?...ror&page=2
and
http://goosebumps4all.net/w4you/related....ror&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?...om/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

#2
[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


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.