views:

241

answers:

1

Hi

I'm running a Kohana setup on my local apache server. I've created a 'htdocs' folder which houses the index.php file in the kohana directory. So that the system files are not available to visitors. Now I wan't to remove index.php from the URL everytime I visit another controller, so I've tried fooling around with the .htaccess provided but can't get it to work. Anybody here with some skill with this?

The .htaccess file:

# Turn on URL rewriting
RewriteEngine On

# Installation directory
RewriteBase /

# Protect hidden files from being viewed
<Files .*>
    Order Deny,Allow
    Deny From All
</Files>

# Protect application and system files from being viewed
RewriteRule ^(?:application|modules|system)\b.* index.php/$0 [L]

# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php/$0 [PT]

The file is placed in the kohana directory. Apparently I'm only supposed to alter the RewriteBase variable, but I have no idea on what it should be

+1  A: 

RewriteBase basically is the URL from where you are reached.

For example if the URL to index.php is http://yoursite/kohana/index.php you'd set RewriteBase to /kohana.

You can find the docs for mod_rewrite here: http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html

svens
Thanks for the link. Your tip didn't really work out for me though. The address to my kohana directory is: http://localhost/kohana/htdocs and the .htaccess is in the kohana folder, should it just be 'RewriteBase /kohana/htdocs' then? (that doesn't work)
soren.qvist
Sorry I'm no mod_rewrite guru too, but if you can reach your index.php file like `http://localhost/kohana/htdocs/index.php` the RewriteBase should be /kohana/htdocs as far as I know.
svens