如何在主索引页面上使用mod重写?

How do I use mod_rewrite in index.php? Generally I am using this code:

RewriteRule ^page/([^-]*)/([^-]*)$ /page.php?xxx=$1&yyy=$2 [L]

and loading the page www.example.com/page/11111/2222222.

This works as expected. But now I want to apply .htaccess for using url in this format: www.example.com/11111/2222222 and use all code in page.php.

How can I do that?

Simple, remove the page/ from your rule and use this way:

RewriteRule ^([^-]*)/([^-]*)$ /page.php?xxx=$1&yyy=$2 [L]

Try this

In .htacces

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+/?)$ page.php?url=$1 [NC]

And then, in page.php:

$params = explode("/", $url);
//$params[0] = '11111', $params[1] = '2222222', and so on....