Please, help me with my logic of mod_rewrite usage. I really don't have so much expirience like some of guys in here but willing to learn.
I am trying to write general .htaccess mod_rewrite rules to use it on most of my production sites. I am using rather trivial url variable method to generate content pages trough my sites.
eg:
1. index.php?content=something [calls general list]
2. index.php?content=something&action=view&id=34 [shows entry]
3. index.php?content=something&action=send [eg. submtes new entry]
I wan't to rewrite im like this:
somesite.com/something/
somesite.com/something/view/34/
somesite.com/something/send/
Now... I am not shure should I CONSTANTLY rewrite both 3 variables and pass it to my script (like this):
- Code: Select all
RewriteRule ^(.*)/(.*)/(.*)/$ index.php?content=$1&action=$2&id=$3
... OR I should have Rewrite Conditions for NUMBER of variables sent, and then redirection to link with one or two or three variables sticked to it:
1. if there is only one parametar - www.pero.com/bla/
2. rewrite to script and give just one parametar -
- Code: Select all
RewriteCond %{REQUEST_URI} ^(.*)/$
RewriteRule ^(.*)/$ index.php?content=$1
RewriteCond %{REQUEST_URI} ^(.*)/(.*)/$
RewriteRule ^(.*)/(.*)/$ index.php?content=$1&action=$2
RewriteCond %{REQUEST_URI} ^(.*)/(.*)/(.*)/$
RewriteRule ^(.*)/(.*)/(.*)/$ index.php?content=$1&action=$2&id=$3
Anyways, my RewriteCond / RewriteRule rules are not working. I get so strange results with 3 variables passed.
Please help me out.
Thank you in advance
7even