I’m building a mini framework that supports:
mysite.com/template/
mysite.com/template/action/
mysite.com/template/action/model/
Using as a bootstrap:
RewriteEngine On
RewriteCond %{REQUEST_URI} !=/index.php
RewriteRule .* /index.php
But for any request:
mysite.com/template/action/model/**extra/stuff/should/vanish/**
So that the maximum URL size will always drop anything extra:
mysite.com/template/action/model/
You do mean something like this?
This redirects the browser so that it only preserves the 3 nodes if there are more than 3. This should probably go above your routing rules.
EDIT:
You’ll need a specific rule to match against the query string here, it’s beyond what you can do in the expression of a
RewriteRule. You can put these rules either before or after the above one:The query string (everything after the
?) isn’t part of the URI that is used in the rewrite engine, it requires a special condition.