Results 1 to 2 of 2

Hybrid View

  1. #1

    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         }     } ?>
    Thanks for any help...

  2. #2
    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=250000
    Hyperconfused (™)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •