Jump to content
Mike Rockett

.htaccess rewriting through 'it' query param

Recommended Posts

Just curious as to why all requests that are sent to index.php are routed through the it GET param...

RewriteRule ^(.*)$ index.php?it=$1 [L,QSA]

Any particular reason why it isn't simply this:

RewriteRule ^(.*)$ index.php [L,QSA]

Or even this:

RewriteRule ^ index.php [L,QSA]

?

Share this post


Link to post
Share on other sites

I am a newbie to ProcessWire, so I am only guessing here based on my experience with other CMS's...

The requested path needs to be provided to the processwire system somehow, so it knows what page to show. If you're not using a CMS or a framework, then usually what is served to the browser is a php or html file that exists at the requested path... but with a CMS like processwire, there aren't actual files on the server for all the pages that are created in the dashboard. So instead, ALL requests for all paths are sent to the processwire system, and it examines what the requested path was and retrieves the appropriate content from the database based on that. The "it" variable is how the requested path is communicated to processwire from apache. I've seen other systems use a different approach, using php's $_SERVER['PATH_INFO'] , but sometimes this causes problems depending on the server settings, so perhaps processwire avoids this method to cut down on potential problems.

  • Like 1

Share this post


Link to post
Share on other sites

To be honest ProcessWire is the first system i've come across where requests have to be routed specifically to a GET param, but i guess it's just a code design decision.

It does bring up some issues though with using PHP 5.4's local -S test server.

  • Like 1

Share this post


Link to post
Share on other sites

Once again, I don't know how I missed the first reply... Sorry about that.

@mrjasongorgman - Yeah, I just don't see it often anywhere. There has to be a really good reason for it...

@jordanlev - The paths would be routed to PW with both methods. Only trying to figure out why it goes through a GET param...

Anyways, it works - so I couldn't complain. That said, I'd love to know the reason.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...