views:

21

answers:

1

I am trying to rewrite some url's. All the Urls look something like this

www.domain.com/index/c/index/ www.domain.com/index/c/about/ www.domain.com/index/c/store/

I would like these urls to look like the following:

www.domain.com www.domain.com/about www.domain.com/store

I have tried several different things in the htaccess file but haven't had any luck.

RewriteRule ^([^/.]+)/?$ /index/c/$1 [L]

+2  A: 

Okay, I am admittedly not that awesome at either htaccess or regex, but I'm trying to learn more so hopefully this helps:

It looks like you're trying to match anything that follows the first slash after your URL.

This slash should actually be included in your Rewrite base, so you'd want your htaccess to be:

RewriteEngine on
RewriteBase /

RewriteRule ^(.*)$ index/c/$1 [L]

If you'd rather not just match everything, you could try using ranges such as

RewriteRule ^([A-Za-z])$ index/c/$1 [L] which I think should match all letters.

Also, please note that RewriteEngine on and RewriteBase / are key lines! you need them for your htaccess to work. (although the / part of RewriteBase can be modified, in your case you want to just use a '/')

quoo