how to remove index.php from all of my methods or cntrollers and redirect them to without index.php url |
[eluser]dhananjay[/eluser]
like when i have url like this http://jobr.in/clients/the-school-shop/i...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
[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
[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/i...user/login
[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'] = '';
[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/i...user/login
[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?
[eluser]dhananjay[/eluser]
brother , you are not understanding the prob. prob is both url are working already http://jobr.in/clients/the-school-shop/i...user/login http://jobr.in/clients/the-school-shop/user/login but i have to redirect http://jobr.in/clients/the-school-shop/i...user/login to this http://jobr.in/clients/the-school-shop/user/login urls with index.php should not be accessible
[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.
[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.
[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..... |
Welcome Guest, Not a member yet? Register Sign In |