CodeIgniter Forums
How to leaves old link - routing? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: How to leaves old link - routing? (/showthread.php?tid=27536)

Pages: 1 2


How to leaves old link - routing? - El Forum - 02-13-2010

[eluser]devastator[/eluser]
Hello, i'm new here and for first time i will use codeigniter because he is very easy to use and have SUPRB user guide. Now my problem i have my old site he have very very good positions in google for long keywords and url are article.php?id=article_id i want to leaves them that only this url for articles all other to be dada/dada/213 how to make that? I put this routing
Code:
$route['article.php?id=(:num)'] = "article/index/$1";
but still not work i have 404 page error and I have article controller and index method with param $id


How to leaves old link - routing? - El Forum - 02-13-2010

[eluser]cahva[/eluser]
I dont think you can do that with routes as it is used (to my knowledge) what happens AFTER index.php.
Use .htaccess and 301 redirect(with mod_rewrite) instead.


How to leaves old link - routing? - El Forum - 02-14-2010

[eluser]Cro_Crx[/eluser]
You need to enable query strings in your config.php file. It will be set to false, so set to true.

Having clean URL's will help your website rankings in the long term, so leaving the URL's as is just for the rankings is silly because it will end up hurting your rankings eventually compared to clean URL's.


How to leaves old link - routing? - El Forum - 02-14-2010

[eluser]devastator[/eluser]
I use this redirect

RewriteRule ^article.php?id=(.*)$ /article/index/$1 [L]

but not work
changing config file also don't work

My site have 10 000 uniques per day 90% of them are form google that articles are in first-five positions. I want to not change the urls because google will reindexing me 2-3 months and visits will be more more lower.

I try everything that i know and think will work. Please help me to hardcode that.


How to leaves old link - routing? - El Forum - 02-18-2010

[eluser]devastator[/eluser]
Can someone help me?


How to leaves old link - routing? - El Forum - 02-19-2010

[eluser]n0xie[/eluser]
Did you try this?

Code:
RewriteRule ^article.php?id=(.*)$ index.php/article/index/$1 [L]



How to leaves old link - routing? - El Forum - 02-19-2010

[eluser]devastator[/eluser]
Yes and still got 404 page not found...


How to leaves old link - routing? - El Forum - 02-20-2010

[eluser]n0xie[/eluser]
Are you sure mod_rewrite is enabled?


How to leaves old link - routing? - El Forum - 02-20-2010

[eluser]devastator[/eluser]
Yup i remove index.php with him

that is all my htaccess file

Code:
Options +FollowSymlinks -Indexes
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|robots\.txt|sitemap\.xml)
RewriteRule ^(.*)$ index.php/$1 [L]
RewriteRule ^article.php?id=(.*)$ /article/index/$1 [NC,L]

I think it's need to edit routes.php file and i set this
Code:
$route['article.php?id=(:num)'] = "article/index/$1";
and in config.php i set this
Code:
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
to this
Code:
$config['permitted_uri_chars'] = '';
and STILL i get 404 page not found O_O

in log file i get this
Code:
DEBUG - 2010-02-21 03:31:12 --> Config Class Initialized
DEBUG - 2010-02-21 03:31:12 --> Hooks Class Initialized
DEBUG - 2010-02-21 03:31:12 --> URI Class Initialized
ERROR - 2010-02-21 03:31:12 --> 404 Page Not Found --> id



How to leaves old link - routing? - El Forum - 02-22-2010

[eluser]n0xie[/eluser]
Put the RewriteRule above your other RewriteRules.