how to remove index.php from all of my methods or cntrollers and redirect them to without index.php url - 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 remove index.php from all of my methods or cntrollers and redirect them to without index.php url (/showthread.php?tid=53413) Pages:
1
2
|
how to remove index.php from all of my methods or cntrollers and redirect them to without index.php url - El Forum - 07-23-2012 [eluser]dhananjay[/eluser] like when i have url like this http://jobr.in/clients/the-school-shop/index.php/user/login i want it to redirect to this one http://jobr.in/clients/the-school-shop/user/login i have done pretty research but none of them working Thanks a lot how to remove index.php from all of my methods or cntrollers and redirect them to without index.php url - El Forum - 07-23-2012 [eluser]nfdevil[/eluser] In the documentation, it's all noted... Code: http://ellislab.com/codeigniter/user-guide/general/urls.html The second header: Removing the index.php file how to remove index.php from all of my methods or cntrollers and redirect them to without index.php url - El Forum - 07-23-2012 [eluser]dhananjay[/eluser] have added this in my htacess file and its not making any diffrence RewriteEngine on RewriteCond $1 !^(index\.php|images|robots\.txt) RewriteRule ^(.*)$ /index.php/$1 [L] check this url http://jobr.in/clients/the-school-shop/index.php/user/login how to remove index.php from all of my methods or cntrollers and redirect them to without index.php url - El Forum - 07-23-2012 [eluser]nfdevil[/eluser] Are you sure that mod_rewrite is enabled on your server? Create a PHP page on your web server. For demonstration purposes, call this page phpinfo.php. This file should read as follows: PHP Code: Code: <?php phpinfo(); ?> Also, make sure that you set Code: $config['index_page'] = ''; how to remove index.php from all of my methods or cntrollers and redirect them to without index.php url - El Forum - 07-23-2012 [eluser]dhananjay[/eluser] i have checked mod _rewrite has been enabled also made this change Also, make sure that you set $config['index_page'] = ''; now its still same http://jobr.in/clients/the-school-shop/index.php/user/login how to remove index.php from all of my methods or cntrollers and redirect them to without index.php url - El Forum - 07-23-2012 [eluser]nfdevil[/eluser] I don't see what is wrong with it now, go to http://jobr.in/clients/the-school-shop/user/login it works, no? how to remove index.php from all of my methods or cntrollers and redirect them to without index.php url - El Forum - 07-23-2012 [eluser]dhananjay[/eluser] brother , you are not understanding the prob. prob is both url are working already http://jobr.in/clients/the-school-shop/index.php/user/login http://jobr.in/clients/the-school-shop/user/login but i have to redirect http://jobr.in/clients/the-school-shop/index.php/user/login to this http://jobr.in/clients/the-school-shop/user/login urls with index.php should not be accessible how to remove index.php from all of my methods or cntrollers and redirect them to without index.php url - El Forum - 07-23-2012 [eluser]CroNiX[/eluser] It doesn't matter if they are "accessible" if there aren't any links to them (search engines only catalog actually links, and they don't "guess"), unless these are old urls that you are trying to get out of search engines or something. If you use the url helpers, like anchor(), then you won't have to do anything else to clean up your urls once you change $config['index_page'] to empty string. It won't make links with "index.php" in them. However, if you didn't, and you manually created your anchors using straight up html, then you will have to fix all of those by hand and remove the "index.php". Hopefully you used the CI anchor() function. The same goes for images and forms. If you made them by hand instead of using CI's helpers, you will have to manually fix all of them. how to remove index.php from all of my methods or cntrollers and redirect them to without index.php url - El Forum - 07-23-2012 [eluser]nfdevil[/eluser] Yup, didn't understand it. Put this in your main controllers' __construct after calling the parent::__construct() Code: if(preg_match('/index.php\/.*/',$_SERVER['REQUEST_URI'])){ The $_SERVER['REQUEST_URI'] is a non-routed url, current_url() is already routed thru your routes.php config file. Hope this helps. how to remove index.php from all of my methods or cntrollers and redirect them to without index.php url - El Forum - 07-23-2012 [eluser]dhananjay[/eluser] CroNiX i have used base_url() to get urls and i have made $config[‘index_page’] = ‘’; too so now all links on my website are without index.php but all links can be accessed if we add index.php i just want to make sure this will not make any effect on seo of website will not be these treated as duplicate content thats all i want to know..... |