Results 1 to 2 of 2
Hybrid View
-
03-24-2004, 05:04 PM #1Newbie
- Join Date
- Mar 2004
- Posts
- 10
Trying to get "Clean URLs" to work - blah.com/?page=about&sub=contact?
I'm trying to use "Clean URLs" to make my future page look simple. For example, right now I'd like a "url.com/about/" section with the subsections "url.com/about/advertise/" and "url.com/about/contact/", etc. The actual URL would be http://url.com/?page=about&sub=advertise or contact, etc. I'm having a difficult time understanding how to do this using mod_rewrite. I don't understand what the ^ does and [a-z] or whatever and cannot do it on my own. Can anyone help me?
I *DID* get it to work doing it with the ForceType method below, but as you can see it doesn't contain the ?page=about&sub=advertise that I can only do with mod_rewrite. Can someone make a small example for me or guide me through it? Thanks.
---------------------
ForceType code -- not what I want.
Code:.htaccess
PHP Code:<FilesMatch "^about$"> ForceType application/x-httpd-php </FilesMatch>
Code:'about' file
PHP Code:<?php $expl = explode("/",$HTTP_SERVER_VARS["REQUEST_URI"]); $subsection = $expl[2]; if ($expl[1] == "about") { if ($subsection == "advertise") { print "advertise subsection - e-mail us for information"; } elseif ($subsection == "contact") { print "contact form subsection - email us to contact us."; } elseif ($subsection == "staff") { print "staff subsection - learn about us"; } else { ?> welcome to our about section. here you can find out about our: <a href="advertise/">advertising</a>,<a href="contact/">contact us</a>, or view our staff's <a href="staff/">information</a> <?php } } ?>
-
03-24-2004, 05:11 PM #2Retired Moderator
- Join Date
- Apr 2003
- Location
- London, UK
- Posts
- 4,721
There's a nice thread below on this very subject
http://www.webhostingtalk.com/showth...hreadid=250000Hyperconfused (™)