So, thinking and creating a new site, video gallery style, with categories, models, videos, etc.
I created scripts, pages, urls, etc., now it would be nice to create an url_rewriter, to simplify and make urls more SEO.
But I got messed up and I'm getting confused more and more.
These are the urls of my site, and the urls in which I would like to transform them.
index.php
my-url.com
categories.php
my-url.com/categories/
category.php?category=category
my-url.com/category/
category.php?category=category&page=1
my-url.com/category/page-1/
category.php?category=category&sort=sort
my-url.com/category/sort/
category.php?category=category&page=1&sort=sort
my-url.com/category/page-1/sort/
my-url.com/models.php
my-url.com/models/
my-url.com/model.php?model=Model-Name
my-url.com/model/Model-Name
my-url.com/model.php?model=Model-Name&page=1
my-url.com/model/Model-Name/page-1/
my-url.com/model.php?model=Model-Name&sort=sort
my-url.com/model/Model-Name/sort/
my-url.com/model.php?model=Model-Name&page=1&sort=sort
my-url.com/model/Model-Name/page-1/sort/
my-url.com/videos.php
my-url.com/videos/
my-url.com/videos.php?page=1
my-url.com/videos/page-1/
my-url.com/videos.php?sort=sort
my-url.com/videos/sort/
my-url.com/videos.php?page=1&sort=sort
my-url.com/videos/page-1/sort/
my-url.com/video.php?title=video-title
my-url.com/video/video-title.html
This is the url rewrititng that I have written so far and that now does what it wants, and not what it should do or I would like it to do.
RewriteRule ^([^/]+)\/$ category.php?category=$1 [NC,L]
RewriteRule ^([^/]+)/page-([^/]+)/$ category.php?category=$1&page=$2 [NC,L]
RewriteRule ^([^/]+)\/([^/]+)\/$ category.php?category=$1&sort=$2 [NC,L]
RewriteRule ^([^/]+)/page-([^/]+)/([^/]+)/$ category.php?category=$1&page=$2&sort=$3 [NC,L]
RewriteRule ^models/$ models.php
RewriteRule ^model/([[A-Za-z0-9_]]+)\/$ model.php?model=$1 [NC,L]
RewriteRule ^model/([^/]+)/page-([^/]+)\/$ model.php?model=$1&page=$2 [NC,L]
RewriteRule ^model/([^/]+)\/([^/]+)\/$ model.php?model=$1&sort=$2 [NC,L]
RewriteRule ^model/([^/]+)/page-([^/]+)/([^/]+)\/$ model.php?model=$1&page=$2&sort=$3 [NC,L]
RewriteRule ^videos/$ page.php
RewriteRule ^videos/page-([^/]+)\.html$ page.php?page=$1 [NC,L]
RewriteRule ^video/([^/]+)\.html$ out.php?id_photo=$1 [NC,L]
By now I think I really messed up, and the more I touch it the worse it seems to go... even if I go to the url my-site.com/model/Model-Name, he understands that he must use the model.php file, but not sees the model-name variable, and I really don't understand why anymore.
So, I need some help to understand how to write the url_rewriter.
And I'd also like to know if this is the best directory/url structure for a site like this or if there are better ones.
Any suggestions or help will be truly appreciated (because I'm really confused)