Welcome Guest, Not a member yet? Register   Sign In
Mod_rewrite with folders in views [SOLVED]
#11

[eluser]Ludovic-r[/eluser]
Without index.php : http://localhost:8888/website/controller/function/

With : http://localhost:8888/website/index.php/.../function/
#12

[eluser]InsiteFX[/eluser]
Map a new route in the application/config/routes.php file!

CodeIgniter User Guide -URI Routing

InsiteFX
#13

[eluser]Zaher Ghaibeh[/eluser]
mapping the URI is not the best scenario but it might solve the problem ..

i think its something related to the CI itself .. can you try to get an old version lets say 2.0.0 or try to change to the CORE one .. for me i switched to the CORE since i need something stable..
#14

[eluser]Ludovic-r[/eluser]
The routing methode doesn't seems to work, my urls stay as they are. Any ideas?
#15

[eluser]Zaher Ghaibeh[/eluser]
which version are you using ?
#16

[eluser]d1a8lo24[/eluser]
I have run into a lot of problems with this specially trying to deploy an application in different server environments so this is what i do to narrow down the problems.

1. first make sure that mod_rewrite is enable and that the server is allowed to read the htaccess file from the folder, I had this problem when I first try to run my own server using ubuntu.

You can read here for my solution
http://ellislab.com/forums/viewthread/184961/

2. Try the following .htaccess code
Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    #Removes access to the system folder by users.
    #Additionally this will allow you to create a System.php controller,
    #previously this would not have been possible.
    #'system' can be replaced if you have renamed your system folder.
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]
    
    #When your application folder isn't in the system folder
    #This snippet prevents user access to the application folder
    #Submitted by: Fabdrol
    #Rename 'application' to your applications folder name.
    RewriteCond %{REQUEST_URI} ^application.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    #Checks to see if the user is attempting to access a valid file,
    #such as an image or css document, if this isn't true it sends the
    #request to index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
    
</IfModule>

<IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    # Submitted by: ElliotHaughin

    ErrorDocument 404 /index.php
</IfModule>

If that doesn't work try looking at your error logs for any other errors.
#17

[eluser]Ludovic-r[/eluser]
Hi, thanks for your answer, where should I put the :

<Directory /directory/path>
AllowOverride all
</Directory>

please, many thanks!
#18

[eluser]d1a8lo24[/eluser]
Depending on your server setup there are 3 place where you can specify which mods or configurations can be loaded or set.
These are the following files just do a search for them

apache2.conf
httpd.conf

The following I think only applies to unix servers and I think mosly ubuntu.

Under you sites-enable folder the file that enables a new or default site can also have this configurations.

First check to see if the configuration is anywhere on these files do a qucik search for AllowOverride.
<Directory /directory/path>
AllowOverride all
</Directory>

And they all should be where your apache server installation is.

Try the new .htaccess first and then if it doesn't work try this solution only if the server setup is not allowed to read the .htaccess file on the root directory.

By the way you can open these files on most code editors.
#19

[eluser]Ludovic-r[/eluser]
Ok,

I have the AllowOverride all enabled, but the index.php remain in my urls and I can't figured out how to remove that T_T

The .htaccess is working, I've removed the "index.php" in my CI config file, everything seems to be ok because when I click on a link in my page the index.php is well removed from the url but it sill gives me a 404 error

I'm desesperate..
#20

[eluser]d1a8lo24[/eluser]
At this point the only thing that will be a next step is if you have a live server upload your app and see if it works.

also the following link might help you a little more these are great tutorials i know that either in the first or second video they explain how to remove the index.php.
http://net.tutsplus.com/sessions/codeign...m-scratch/

One last test on your local server.

remove everything from your root folder make sure you backup your work.

Download afresh CI install do your standard configurations, add the htaccess file on the root folder. And now create a new testing controller you don't have to create a new view just echo anything out. and got to your URL http://localhost/testing see if that works.
Make sure your testing controller is not your main controller , just leave the welcome controller as is.

If you still get an error then your server setup is the problem if not then you need to review your code.




Theme © iAndrew 2016 - Forum software by © MyBB