Mod Rewrite or HTTPD.Conf Rewrite?

Discussion in 'Apache' started by LazyD, Sep 12, 2007.

  1. #1
    I know the title sounds akward but heres what im trying to do...

    Im writing a custom CMS, one of the tables has a column called "Path", for instance, the "About Us" section's path is "/about", Currently im using "index.php?path=about" and PHP $_GET to grab "about" from the table - What I want to do is to be able to just point my browser to something like www.mydomain.com/about and have it grab the about and display the contents, other paths would be like www.mydomain.com/about/story which would be a child of story and the path for it would be "/about/story" in the table...

    Is this possible with mod_rewrite in the htaccess or do I have to go with something server level in Apache?
     
    LazyD, Sep 12, 2007 IP
  2. powerspike

    powerspike Peon

    Messages:
    312
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #2
    you can do either, it's fine

    but for SPEED, you should put your rewrite rules into a htaccess file, include the htaccess file with your apche config (include htdocs/.htaccess) and turn off dymanic modrewrite - the busier and bigger your site gets, the more it kicks in (when you have dynamic mod rewrite enabled it does alot of disk seeks and reads).
     
    powerspike, Sep 13, 2007 IP
  3. LazyD

    LazyD Peon

    Messages:
    425
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for the response - Now, whats the syntax to accomplish what I want? Thats the biggest issue now...
     
    LazyD, Sep 13, 2007 IP
  4. powerspike

    powerspike Peon

    Messages:
    312
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #4
    RewriteRule $/about/^ /index.php?path=about [L,NC]

    something like that should do it
     
    powerspike, Sep 13, 2007 IP