Click to See Complete Forum and Search --> : .htaccess simple fix?


markosaurus
09-30-2008, 12:13 PM
Hi there,

Just wondered if anyone may be able to help me finish sorting this out?

I have been trying to do my first site with SEF URL's. So far so good, bubt I've hit a wall and I've completely confused myself. I'm so close to getting this working as I want, but can't seem to work the last part out.

I usually use URL's in this form;
www.domain.com/index.php?section=home

I want them to appear in this form;
www.domain.com/home/

I am using the following in my .htaccess;
<files index>
ForceType application/x-httpd-php
</files>

RewriteEngine on

RewriteRule ^$ index
RewriteRule ^/([a-zA-Z0-9]+)//([a-zA-Z0-9]+)$ index?section=$2

My base file is called index (not index.php), this is being declared in the first statement in my htaccess file as a forcetype directive.

So far, the first rewrite rule redirects anything without any parameters to my index file

The second rewrite then diverts anything in the form of; www.domain.com/index/news/

to;
www.domain.com/index?section=news

This works fine so far.

I now want to get rid of the /index/ part so that www.domain.com/news/

diverts to;

www.domains.com/index?section=news

I just can't get this to work.

Any ideas?