Removing the index.php file |
[eluser]asim111[/eluser]
Hi, i am new to CI. i have been developed an "auto dealer" module by using CI. i want to remove index.php from the URL... Todo this, i created a .htaccess file Code: Options +FollowSymLinks secondly,i modified config file Code: $config['index_page'] = "index.php"; Code: $config['index_page'] = ""; this project is working 100% on local server. but on live server it is not working properly ON LIVE SERVER its automatically changing site url like Code: http://www.auto_site_url.co.uk/ Code: http://www.auto_site_url.co.uk/index.php/ and due to this, displaying error page with message Code: An Error Was Encountered i think something wrong with .htaccess file, but not sure please help me to resolve this issue thanks
[eluser]Flemming[/eluser]
Hi Asim, if you remove the mod_rewrite rules and replace $config['index_page'] = "index.php"; in your config file, does the site work properly? If it does then you know for sure that the problem is with your mod_rewrite - although it looks fine to me. If it doesn't ... then there is a problem elsewhere! HTH
[eluser]asim111[/eluser]
Hi, i tried with index.php.... it is working on other hand, i resolved this error Code: An Error Was Encountered i created my custom library called MY_Validator.php and my live server is linux based. on linux filenames are case sensitives. i renamed MY_Validator.php file to my_validator.php now its look ok to me. but now problem is: i can visit my site without any error by using Code: http://www.mysite.co.uk/index.php/used-cars/ but i like to access like Code: http://www.mysite.co.uk/used-cars/ more intresting thing. it automatically adding index.php if i will type http://www.mysite.co.uk/used-cars/ it will automatically convert url to Code: http://www.mysite.co.uk/index.php/used-cars/ and i can see perfect page... any idea bro...?
[eluser]Flemming[/eluser]
It must be getting the 'index.php' from your config file! Check you have this set correctly : $config['index_page'] = ""; If in doubt, try putting this in your config : $config['index_page'] = "foobar.php"; See what happens - if you find that your urls are being rewritten now with foobar.php on the end then it's clearly coming from your config.php! HTH
[eluser]asim111[/eluser]
Hi again! i tried to change config file nothing happened. but when i changed .htaccess file to index.php to foo.php Code: RewriteRule ^(.*)$ http://www.mysite.co.uk/foo.php/$1 [L] i typed in browser: Code: http://www.mysite.co.uk/used-cars/ Code: http://www.mysite.co.uk/foo.php/foo.php/foo.php/foo.php/foo.php/foo.php/foo.php/foo.php/foo.php/foo.php/foo.php/foo.php/foo.php/foo.php/foo.php/foo.php/foo.php/foo.php/foo.php/foo.php/used-cars/ My route file is like: Code: $route['default_controller'] = "main"; I think logical error some where... but why it is working fine on my local machine. urls & everything
[eluser]Flemming[/eluser]
It doesn't make any sense! if you STOP using the .htaccess rewrite (ie. as initial installation) and put Code: $config[‘index_page’] = ”index.php“; then you should be able to visit Code: http://www.mysite.co.uk/index.php/used-cars/ and it should work fine? ???
[eluser]asim111[/eluser]
Now my .htaccess file is blank and added index.php into config.php file I can access my site Code: http://www.mysite.co.uk/index.php/used-cars/ But error with this Code: http://www.mysite.co.uk/used-cars/ Error is Code: Page not found
[eluser]Flemming[/eluser]
Excellent! So it is working as expected now! :-) because you can access your site without any problems at Code: http://www.mysite.co.uk/index.php/used-cars/ I would suggest you post your entire .htaccess file so we can take a look. However - the .htaccess / mod_rewrite is an apache specific feature, NOT a codeIgniter feature so there is not a 100% guaranteed solution to making it work. You can try searching the forum for .htaccess and mod_rewrite help / examples ? Post your .htaccess here as well and I'll take another look at it!
[eluser]asim111[/eluser]
my simple .htaccess file Code: Options +FollowSymLinks thank you for help...
[eluser]Flemming[/eluser]
It looks ok to me but here's the one I use if you want to give it a try, for comparrison ... Code: RewriteRule ^/(index\.php|robots\.txt|favicon\.ico).*$ - [s=1] let me know what happens! |
Welcome Guest, Not a member yet? Register Sign In |