更改网址不包括/index.php

I have a simple profile system in place that has a URL re-write that changes URLs like:

www.domain.com/profile.php?id=user 

To:

www.domain.com/user

Using:

RewriteEngine on
RewriteRule ^([A-Za-z0-9]+)$ profile.php?id=$1 [L]

That being said, how would I change the URL:

www.domain.com/something/index.php

To:

www.domain.com/something

Without disrupting the profile URL setup? Would I just put the rewrite higher up in the .htaccess file? Thank you for helping a rookie out.

If something is not constant it is not possible to do that, you need to use another url pattern like www.domain.com/page/something. However, if the `something constant, you can use;

RewriteEngine on
RewriteCond !^something [NC]
RewriteRule ^([A-Za-z0-9]+)$ profile.php?id=$1 [L]

RewriteCond ^something [NC]
RewriteRule ^something something/index.php [L] 

If you use different url pattern like ;

www.domain.com/page/something you can use;

RewriteEngine on
RewriteRule ^page/([A-Za-z0-9]+)$ $1/index.php [L]

You can use this rule to remove /index.php from any where:

DirectoryIndex index.php
RewriteEngine On

RewriteCond %{THE_REQUEST} /index\.php [NC]
RewriteRule ^(.*?)index\.php$ /$1 [L,R=301,NC,NE]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([A-Za-z0-9]+)/?$ profile.php?id=$1 [L,QSA]