Grokbase Groups PHP cake-php May 2012
FAQ
Hi,

I am just about relaunching a website and they gave out tons of QR Codes
with links like:
www.domain.com/detail.php?id=1234
What can I do to catch all this domains having the "details.php?Id=" and
forward this to (controller=>detail action=>index, 1234)
Is there a way to handle this with Router::connect rules?

Thanks for any help!

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Search Discussions

  • Điển vũ at May 8, 2012 at 3:46 pm
    Put this code ( modify it fit with your code ) in boostrap.php

    if (preg_match('/details\.php?id=(.*)/', $_SERVER['REQUEST_URI'],
    $match) !== false) {
    if (isset($match[1])){
    $location = '/details/index/' . $match[1]
    header('Location: ' . $location, true, 301);
    die();
    }
    }

    --
    Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
    Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


    To unsubscribe from this group, send email to
    cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
  • Thiago Belem at May 8, 2012 at 3:48 pm
    CakePHP 2.0 has Router::redirect()

    http://book.cakephp.org/2.0/en/development/routing.html#redirect-routing


    --
    ***Thiago Belem*
    Desenvolvedor
    Rio de Janeiro - RJ - Brasil

    *Assando Sites* - Curso online de *CakePHP*
    assando-sites.com.br <http://goo.gl/b1EEd>

    thiagobelem.net
    contato@thiagobelem.net

    *Skype / gTalk **»* thiago.belem.web
    *LinkedIn* *»* br.linkedin.com/in/thiagobelem/pt


    On Tue, May 8, 2012 at 12:46 PM, Điển vũ wrote:

    Put this code ( modify it fit with your code ) in boostrap.php

    if (preg_match('/details\.php?id=(.*)/', $_SERVER['REQUEST_URI'],
    $match) !== false) {
    if (isset($match[1])){
    $location = '/details/index/' . $match[1]
    header('Location: ' . $location, true, 301);
    die();
    }
    }

    --
    Our newest site for the community: CakePHP Video Tutorials
    http://tv.cakephp.org
    Check out the new CakePHP Questions site http://ask.cakephp.org and help
    others with their CakePHP related questions.


    To unsubscribe from this group, send email to
    cake-php+unsubscribe@googlegroups.com For more options, visit this group
    at http://groups.google.com/group/cake-php
    --
    Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
    Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


    To unsubscribe from this group, send email to
    cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
  • Heohni at May 14, 2012 at 12:08 pm
    If I try this: (from the 2.0 book)

    Router::redirect(
    '/details*',
    array('controller' => 'qrcode', 'action' => 'redirect',
    array('persist' => true)
    ));

    I get this message:
    The requested address *'/details.php?id=4863'* was not found on this server.

    What is wrong with my Router?


    --
    Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
    Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


    To unsubscribe from this group, send email to
    cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
  • Mike Griffin at May 15, 2012 at 11:12 am

    On Mon, May 14, 2012 at 1:08 PM, heohni wrote:
    If I try this: (from the 2.0 book)

    Router::redirect(
    '/details*',
    array('controller' => 'qrcode', 'action' => 'redirect',
    array('persist' => true)
    ));

    I get this message:
    The requested address '/details.php?id=4863' was not found on this server.

    What is wrong with my Router?
    Are you trying to access /details.php?id=4863 as the url?

    That's not how cake works. Try going to /details or /details/4863 and
    see what happens then.

    Mike.

    --
    Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
    Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


    To unsubscribe from this group, send email to
    cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
  • Heohni at May 16, 2012 at 8:50 am
    Hi Mike,

    these urls /details.php?id=4863 are set in QR codes printed in a magazin.
    Now we plan to relaunch the new website made with cake.

    I want to catch these domains to forward them to the new "cake-style"
    target page.

    Therefore I need a way to lead the users to the requested target and not
    seeing a 404 error.

    --
    Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
    Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


    To unsubscribe from this group, send email to
    cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
  • Rchavik at May 16, 2012 at 9:24 am

    On Monday, May 14, 2012 7:08:36 PM UTC+7, heohni wrote:
    If I try this: (from the 2.0 book)

    Router::redirect(
    '/details*',
    array('controller' => 'qrcode', 'action' => 'redirect',
    array('persist' => true)
    ));
    You could try to use .htaccess to do this:

    RewriteCond %{QUERY_STRING} ^id=([0-9]*)$
    RewriteRule ^details.php /qrcode/redirect/%1? [R=permanent,L]

    This will redirect details.php?id=1 to /qrcode/redirect/1.
    You might want to use the actual 'view' url instead of doing double
    redirection.
    --
    Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
    Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


    To unsubscribe from this group, send email to
    cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
  • Heohni at May 16, 2012 at 9:47 am
    Hi,

    thanks, I will try!
    Which htaccess should I use, the one in /webroot/

    Am Mittwoch, 16. Mai 2012 11:23:55 UTC+2 schrieb rchavik:
    On Monday, May 14, 2012 7:08:36 PM UTC+7, heohni wrote:

    If I try this: (from the 2.0 book)

    Router::redirect(
    '/details*',
    array('controller' => 'qrcode', 'action' => 'redirect',
    array('persist' => true)
    ));
    You could try to use .htaccess to do this:

    RewriteCond %{QUERY_STRING} ^id=([0-9]*)$
    RewriteRule ^details.php /qrcode/redirect/%1? [R=permanent,L]

    This will redirect details.php?id=1 to /qrcode/redirect/1.
    You might want to use the actual 'view' url instead of doing double
    redirection.
    --
    Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
    Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


    To unsubscribe from this group, send email to
    cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
  • Heohni at May 16, 2012 at 10:05 am
    I can answer this myself sorry!
    It works great! Thank you soooooooooooooooooooo much!!!!

    Am Mittwoch, 16. Mai 2012 11:47:43 UTC+2 schrieb heohni:
    Hi,

    thanks, I will try!
    Which htaccess should I use, the one in /webroot/

    Am Mittwoch, 16. Mai 2012 11:23:55 UTC+2 schrieb rchavik:
    On Monday, May 14, 2012 7:08:36 PM UTC+7, heohni wrote:

    If I try this: (from the 2.0 book)

    Router::redirect(
    '/details*',
    array('controller' => 'qrcode', 'action' => 'redirect',
    array('persist' => true)
    ));
    You could try to use .htaccess to do this:

    RewriteCond %{QUERY_STRING} ^id=([0-9]*)$
    RewriteRule ^details.php /qrcode/redirect/%1? [R=permanent,L]

    This will redirect details.php?id=1 to /qrcode/redirect/1.
    You might want to use the actual 'view' url instead of doing double
    redirection.
    --
    Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
    Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


    To unsubscribe from this group, send email to
    cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
  • Heohni at May 15, 2012 at 11:09 am
    Please help!!
    --
    Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
    Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


    To unsubscribe from this group, send email to
    cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcake-php @
categoriesphp
postedMay 8, '12 at 1:43p
activeMay 16, '12 at 10:05a
posts10
users5
websitecakephp.org
irc#cakephp

People

Translate

site design / logo © 2022 Grokbase