Re: URL modification

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Richard Heyes wrote:
Hmmmm... made a quick look into it.
Seems to be apache compatible.
I'm designing a site to be hosted on an IIS Server.

Does it still works there?

On IIS I belive the default document is default.htm Though you should be able to modify this to whatever you please. On Apache it is index.html or index.php (for example). Regardless you want this to be parsed by PHP, and then you can stick the following in it:

<?php
    header('http://www.example.com/login.php');
?>

Place this file in your "login" directory and then you'll be able to publish URLs such as http://www.example.com/login The trailing slash is not necessary if login is a directory. For example:

http://www.websupportsolutions.co.uk/demo


To use url's like http://domain.com/login/ as opposed to http://domain.com/login.php you can take multiple approaches.

The first and simplest is to simply save your login.php as /login/index.php
to use this approach you need to ensure that index.php is listed as a default page.

In IIS you can set the "default" page(s) to be whatever you like:
-> Open IIS Manager
-> Server -> Websites -> Right Click [properties]
-> select "Documents" tab
-> ensure "Enable default content page" is ticked
-> ensure "index.php" is listed
-> if not then click [add] and enter index.php
-> continue to add any other default pages [index.html, index.shtml etc]

The second common solution [and I'd advise to get used to it asap] is to use URL rewriting.

In short url rewriting involves defining "rules" which the web server uses to direct http requests to resources on the server.
eg: direct domain.com/all_our_news to /index.php?newsitem=all

a quick intro guide can be found here:
http://www.sitepoint.com/article/guide-url-rewriting

For URL rewriting in IIS use "ISAPI Rewrite" - http://www.isapirewrite.com/

in apache use mod_rewrite
[apache1.3>] httpd.apache.org/docs/1.3/mod/mod_rewrite.html
[apache2.0>] httpd.apache.org/docs/2.0/mod/mod_rewrite.html

Both are pretty much identical when it comes to the end rewrite rules.

Hope that helps a little

Nathan

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux