Re: Fw: change ? into 'slash'
| From: | Mikael Grön | Date: | Thu, 12 Apr 2007 06:26:27 +0000 |
| Subject: | Re: Fw: change ? into 'slash' | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-27673@lists.php.net to get a copy of this message | ||
Is this what you mean?
www.server.com/index.php?pageid=123
becomes
www.server.com/index.php/123
It's actually the other way around. When the user browses to /index.php/123, the webserver translates that into /index.php?pageid=123 ...
If it's an Apache server, it's done in a .htaccess file located in a folder above the stuff you want to change.
Read here for guides and examples:
http://httpd.apache.org/docs/2.0/misc/rewriteguide.html
On my own site, I have an index.php file which handles incoming page request by a search string. For example:
Someone goes to:
www.emgee.se/hem/kontakt.html
my rewrite script, located in the file .htaccess:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
translates anything written in the URL, except files that actually exist on the server to:
www.emgee.se/index.php?q=hem/kontakt.html
The index.php file gets the $_GET['q']-variable and starts splitting the path and finding the pages in the database. In this case it looks for a page named "kontakt" which is a child-page of a page named "hem".
Hope this gets you on your way.
Mike
bedul skrev:
----- Original Message ----- From: gunawan To: php-windows@lists.php.net Sent: Thursday, April 12, 2007 8:17 AM Subject: change ? into 'slash' if the title is not right.. plz reply to me with the right title. i see on mambo site where the site manage to change ? into / how to make that? are from the skrip or from the configuration? thx 4 reading. fyi.. i'm indonesian