Reputation: 471
How would I be able to rewrite
anyhost.com/argument1/parameter2/some-text/
as
anyhost.com/index.php?path=argument1/parameter2/some-text/
or
anyhost.com/index.php?page=argument1&subpage=parameter2&subsubpage=some-text
or anything like that?
Upvotes: 2
Views: 148
Reputation: 2415
RewriteRule (.*)?/ index.php?path=$1
This is for the first version.
RewriteRule (.*)/(.*)/(.*)?/ index.php?page=$1&subpage=$2&subsubpage=$3
This is for the second one. You can always test your rewrites using this tool.
Upvotes: 1
Reputation: 36957
This should do it:
RewriteEngine On
# First example
RewriteRule ^(.*)$ index.php?path=$1 [L,QSA]
# Second example
RewriteRule ^(.*)/(.*)/(.*)$ index.php?page=$1&subpage=$2&subsubpage=$3 [L,QSA]
The QSA flag is to auto-append any query string from the original URL to the query string sent to index.php; you can remove it if you don't need that functionality.
Upvotes: 1