Results 1 to 5 of 5
  1. #1

    mod_rewrite help

    been trying to get this to work for awhile and can't get it.

    I want my mod rewrite to redirect everything that isn't pointing to a real directory or file to public/index.php .

    I have it working 90% of the way but for some reason, but it refuses to do anything with (base directory) but if I do or it works perfectly fine.

    this is my current code for it:

    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ public/index.php [L]

    I would really appreciate it if somebody could show me where I'm going wrong.

  2. #2
    Join Date
    May 2011
    New Zealand
    You can just use an easy 404 redirect;
    ErrorDocument 404 yoursiteaddress/index.php

  3. #3
    I just gave that a show but it still seems to ignore the base directory and only works if i type something in/ so gets redirected by doesn't and just shows me the directory structure

  4. #4
    Join Date
    Feb 2005
    Turn off autoindexing ("Options -Indexes", or check your global config). You're usually better with this disabled by default to stop people snooping.

    "Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them." - Laurence J. Peter

  5. #5
    thanks foobic for the heads up! I was wondering how that would be done.

Similar Threads

  1. Need help with mod_rewrite
    By OneBinary in forum Programming Discussion
    Replies: 2
    Last Post: 05-17-2005, 11:56 AM
  2. Mod_Rewrite Changes
    By Sticks in forum Hosting Security and Technology
    Replies: 3
    Last Post: 10-23-2004, 11:27 PM
  3. mod_rewrite
    By Alaire in forum Programming Discussion
    Replies: 1
    Last Post: 01-22-2004, 11:47 AM
  4. mod_rewrite
    By Mr. DJ in forum Hosting Security and Technology
    Replies: 8
    Last Post: 12-24-2003, 10:40 AM
  5. mod_rewrite help?
    By tbroeker in forum Hosting Security and Technology
    Replies: 5
    Last Post: 10-11-2003, 01:18 AM

Posting Permissions

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