I am creating a small PHP framework for that websites I create and desired to determine if I'm able to depend on mod_rewrite being availabe of all hosters.

  • Is ist even advisable utilizing it? You will find many good points already (one access point, "beautiful", readable Web addresses)

  • Where isn't it availabe?

  • Must I have an alternative within the framework if mod_rewrite isn't on that hoster?

mod_rewrite is usually available. If it's not on your hosts' servers, drop them.

If you are developing a credit card applicatoin that's openly available, you should look at that mod_rewrite is probably not available and support an alternate. AcceptPathInfo is a.

The MOD_REWRITE module is usually avaiable of all Apache hosts nowadays. However, it isn't Very difficult to operate around its absence, and in so doing you make sure that people stuck on theOrhaving a host/IT staff who've switched them back, or perhaps a host/IT staff running IIS, etc.

Most new frameworks or programs built today use mod_rewrite to intercept all URL demands via a single front loading PHP file (known as Bootstrapping, Frontloading pattern, etc.). The URL portion that isn't the domain title is parsed into some object, which object can be used if you need use of the URL.

When MOD_REWRITE isn't available, Web addresses as

http://example.com/index.php/foo/baz/bar

are utilized rather. A request the above mentioned URL is handled through the index.php file. Then, you are able to parse among the the server variables like

$_SERVER['REQUEST_URI'], $REQUEST['PATH_INFO'], etc.

into some object (exactly the same object you'd use should you have had mod_rewrite) and employ that object if you needed use of the URL information.

In either case, the relaxation of the framework/application just accesses the item, and does not need to bother about the way the information got inside.

Additional Reading through

mod_rewrite is simply for apache so if you want to focus on IIS or something like that else you will have problems, however in PHP additionally you may use this:

private function getURI()



Alter the Web addresses is a great practice, actualy is wide used web is really a Search engine optimization recomendation because is much better have this:

domain.com/aboutus

for this

domain.com/index.php?application=primary&action=show&id=1

It is made in most servers -- but when you think it isn't, you need to create a dynamic method to fetch links -- you can then possess a predefined constant that you simply modify before exactly what states whether mod_rewrite can be obtained. After that you can fetch the Web addresses by using their constant as the best way to know what happens.

I believe any decent application should take advantage of mod_rewrite, and many of web hosting companies are providing this. When they don't offer log off them.

Also, not only mod_rewrite is a great choice to use but additionally other php configurations such as this php_value max_execution_time and so forth to be certain you're designing your atmosphere to suit your application purpose.