Welcome Guest, Not a member yet? Register   Sign In
Mod rewrite - completely stuck!!
#1

[eluser]olivzgraham[/eluser]
I have been trying for absolutely ages, and I cannot get mod_rewrite to work to remove the /index.php/ section of my urls!!

I am using mac os x lion, and the site i am developing is located at:

macintosh hd > users > livvy > sites > barbaraolive

my .htaccess file is inside my code igniter application folder, and is as follows

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>


I am using a virtual host to access my site at http://barbaraolive.local

Code:
<VirtualHost *:80>
    DocumentRoot "/Users/livvy/Sites/barbaraolive"
    ServerName barbaraolive.local
    ErrorLog "/private/var/log/apache2/barbaraolive-error_log"
    CustomLog "/private/var/log/apache2/barbaraolive-access_log" common
</VirtualHost>

which works fine.


i really can't work out how to make this work!! does anyone have any tips on how to debug this, or how i might be able to get it to work? i feel like I've tried everything Sad
#2

[eluser]NeoArc[/eluser]
Sometimes is the fault of this configuration value:

/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
|
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
*/
$config['index_page'] = '';
#3

[eluser]olivzgraham[/eluser]
Thanks for the quick response, i have already made that change...
#4

[eluser]vitoco[/eluser]
First check that mod_rewrite it's enabled, check phpinfo() for "mod_rewrite" . Second use this simple .htaccess file to check if your server works ( it's working on mine )

Code:
Options +FollowSymLinks
RewriteEngine On

RewriteRule ^images - [L,NC]
RewriteRule ^css - [L,NC]
RewriteRule ^js - [L,NC]
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

If it works, it's your code, if it doesn't, it's the server.

Saludos

#5

[eluser]CroNiX[/eluser]
Code:
<IfModule mod_rewrite.c>
The rewrite modules filename isn't "mod_rewrite.c" on all systems.
#6

[eluser]olivzgraham[/eluser]
i checked phpinfo, mod_rewrite is enabled.

vitoco, the .htaccess file you provided still doesn't work! again, http://barbaraolive.local/index.php/site works, but http://barbaraolive.local/site doesn't!
I get the requested url /site/ was not found on this server error.

in php.ini, the module was called mod_rewrite.so, so i altered my original .htaccess to use
Code:
<IfModule mod_rewrite.so>
, still no luck!

#7

[eluser]vitoco[/eluser]
I don't know if this is the problem, but you didn't define override directives

Try this
Code:
<VirtualHost *:80>
    DocumentRoot "/Users/livvy/Sites/barbaraolive"
    ServerName barbaraolive.local
    ErrorLog "/private/var/log/apache2/barbaraolive-error_log"
    CustomLog "/private/var/log/apache2/barbaraolive-access_log" common
    <Directory /Users/livvy/Sites/barbaraolive/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>
</VirtualHost>

Slds.
#8

[eluser]olivzgraham[/eluser]
nope...

in my error log:

[Sun Aug 05 11:12:39 2012] [error] [client 127.0.0.1] File does not exist: /Users/livvy/Sites/barbaraolive/site

in my access log:

::1 - - [05/Aug/2012:11:15:54 +0100] "GET /~livvy/barbaraolive/site HTTP/1.1" 404 331


it's looking for something that doesn't exist! site is my controller...




Theme © iAndrew 2016 - Forum software by © MyBB