views:

44

answers:

2

My web is dir structured is as follows :

moving/
      includes/
      controllers/
      includes/
      etc...


I have the following questions about /moving and all of its sub-diretories:

  1. How can i request any php script without the .php extension?
  2. How can i request ...dir/index.php?q=about as just ...dir/about?
  3. Where woul i place my .htaccess file?

I understand that my first question might be a duplicate, but in order to contextualize my second and third question i had to ask it.

Using WampServer 2.0 Thanks in advance.

A: 

Provided you have mod_rewrite routing non-php extension request to the proper request, you would put it in your root web directory.

jusunlee
+2  A: 

apache will not parse your php script if they don't have the ".php" extention.

but, you can use mod_rewrite:

This module uses a rule-based rewriting engine (based on a regular-expression parser) to rewrite requested URLs on the fly. It supports an unlimited number of rules and an unlimited number of attached rule conditions for each rule, to provide a really flexible and powerful URL manipulation mechanism. The URL manipulations can depend on various tests, of server variables, environment variables, HTTP headers, or time stamps. Even external database lookups in various formats can be used to achieve highly granular URL matching.

This module operates on the full URLs (including the path-info part) both in per-server context (httpd.conf) and per-directory context (.htaccess) and can generate query-string parts on result. The rewritten result can lead to internal sub-processing, external request redirection or even to an internal proxy throughput.internal proxy throughput.

Sirber
"apache will not parse your php script if they don't have the ".php" extention.": What are you talking about? Apache can serve any file extension as PHP if you modify either the config or .htaccess file with `AddType`.
Brian S
I should have added "by default" :)
Sirber