Quantcast

Server Move: Catch old details page url and forward to cake style url

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Server Move: Catch old details page url and forward to cake style url

heohni
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
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Server Move: Catch old details page url and forward to cake style url

Điển vũ
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
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Server Move: Catch old details page url and forward to cake style url

Thiago Belem
CakePHP 2.0 has Router::redirect()



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

Assando Sites - Curso online de CakePHP



On Tue, May 8, 2012 at 12:46 PM, Điển vũ <[hidden email]> 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
[hidden email] 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
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Server Move: Catch old details page url and forward to cake style url

heohni
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
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Server Move: Catch old details page url and forward to cake style url

heohni
In reply to this post by heohni
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
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Server Move: Catch old details page url and forward to cake style url

Mike Griffin
In reply to this post by heohni
On Mon, May 14, 2012 at 1:08 PM, heohni
<[hidden email]> 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
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Server Move: Catch old details page url and forward to cake style url

heohni
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
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Server Move: Catch old details page url and forward to cake style url

rchavik
In reply to this post by heohni
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
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Server Move: Catch old details page url and forward to cake style url

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
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Server Move: Catch old details page url and forward to cake style url

heohni
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
[hidden email] For more options, visit this group at http://groups.google.com/group/cake-php
Loading...