Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2001
    Location
    Mountain Home Arkansas
    Posts
    131

    Arrow help with a mod_rewrite rules

    Howdy,

    I have two questions:

    1) I have this rule in .htaccess that works great for sending stuff back to my core scripts from a sub directory. However it kills any $_REQUEST vars I might want to use
    Code:
    RewriteEngine on
    RewriteBase /
    RewriteRule ^([^.]+)$ https://mydomain.com/?var=$1
    2) How could I exlude certain words so that I could put my mod_rewrite in the web root directory and send it to a sub directory.

    ... for instance, redirect http://mydomain.com/page to http://mydomain.com/core/?page
    I need to exclude 'core' from the mod-rewrite rules.

    Any help will be much appreciated, I consider myself brighter than the adverate joe, but regex gives me a headache
    rocket science is more fun when you accually have rockets!

  2. #2
    Join Date
    May 2004
    Location
    Lansing, MI, USA
    Posts
    1,548
    RewriteCond %{REQUEST_URI} !^/core/.*
    RewriteRule ^([^.]+)$ https://mydomain.com/core/?var=$1 [L]

    maybe?
    Jacob - WebOnce Technologies - 30 Day 100% Satisfaction Guarantee - Over 5 Years Going Strong!
    Website Hosting, PHP4&5, RoR, MySQL 5.0, Reseller Hosting, Development, and Designs
    Powered By JAM - Professional Website Development - PHP, MySQL, JavaScript, AJAX - Projects Small & Large

  3. #3
    Join Date
    Oct 2001
    Location
    Mountain Home Arkansas
    Posts
    131
    SHWEEEEEET! THANKS MAN!

    here is what I ended up with
    Code:
    RewriteEngine On
    RewriteCond %{REQUEST_URI} !^/core/.*
    RewriteRule ^([^.]+)$ index.php?page=$1
    one thing a little wierd about it, is when I put in the url
    http://domain.com/core/
    it rewrites it in the location bar to
    http://domain.com/core/?page=core

    It doesn't seem to hurt anything, it's just kinda weird
    And I can just test the $_REQUEST['page'] var to lock people out from directly accessing the core.
    rocket science is more fun when you accually have rockets!

  4. #4
    Join Date
    Oct 2001
    Location
    Mountain Home Arkansas
    Posts
    131
    ok, I fixed that minor URL bug by changing
    RewriteCond %{REQUEST_URI} !^/core/.*
    to
    RewriteCond %{REQUEST_URI} !^/core.*
    rocket science is more fun when you accually have rockets!

  5. #5
    Join Date
    May 2004
    Location
    Lansing, MI, USA
    Posts
    1,548
    Good. Glad to hear it's working for you
    Jacob - WebOnce Technologies - 30 Day 100% Satisfaction Guarantee - Over 5 Years Going Strong!
    Website Hosting, PHP4&5, RoR, MySQL 5.0, Reseller Hosting, Development, and Designs
    Powered By JAM - Professional Website Development - PHP, MySQL, JavaScript, AJAX - Projects Small & Large

Posting Permissions

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