Results 1 to 3 of 3

Thread: mod_rewrite issue

  1. #1
    ulrik is offline Junior Member
    Join Date
    May 2009
    Posts
    6

    Default mod_rewrite issue

    I am using mod_rewrite to direct requests to my index.php in the document root. My file structure is as follows:

    blog
    |---->html
    |--->images
    |--->css
    |--->js
    |--->index.php
    |---->modules
    |--->default
    |--->admin
    |---->library

    For example, I want the URL http://blog/admin to serve the admin module. This works fine, but when I type the URL http://blog/images/, mod_rewrite directs me to index.php (as in http:///blog/), but I want it to give me a listing of the images directory.

    If I use a .htaccess file to do the rewriting, everything works fine (I get the images directory when I type http://blog/images/).

    If I do the rewrite in the virtual host, I'm taken to http://blog/index.php.
    Below is my Virtual host:

    <VirtualHost *:80>
    ServerName blog
    ServerAdmin email@host.com.au
    DocumentRoot /var/www/htdocs/blog/html
    <Directory /var/www/htdocs/blog/html>
    Options Indexes FollowSymLinks
    AllowOverride None
    </Directory>

    RewriteEngine On
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} -s [OR]
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} -l [OR]
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} -d [OR]
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} -f
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^.*$ /index.php [NC,L]
    </VirtualHost>

    I've been stuck on this for days, and am at the end of my tether!

  2. #2
    ulrik is offline Junior Member
    Join Date
    May 2009
    Posts
    6

    Default

    Sorry the hierarchical directory structure didn't display correctly:

    blog
    |---->html
    ------|--->images
    ------|--->css
    ------|--->js
    ------|--->index.php
    |---->modules
    ------|--->default
    ------|--->admin
    |---->library

  3. #3
    julizar is offline Junior Member
    Join Date
    Nov 2008
    Posts
    2

    Default

    Greetings.
    You can simply add an .htaccess file into the images directory with RewriteEngine Off line.

Similar Threads

  1. mod_rewrite does nothing
    By sawatdee in forum Installation & Configuration
    Replies: 2
    Last Post: 03-26-2010, 12:56 PM
  2. Help with mod_rewrite
    By ulrik in forum Installation & Configuration
    Replies: 1
    Last Post: 09-24-2009, 07:10 AM
  3. help.. mod_rewrite
    By quantro in forum Installation & Configuration
    Replies: 0
    Last Post: 04-28-2009, 05:14 AM
  4. Help with mod_rewrite configuration
    By talw in forum Model-View-Controller (MVC)
    Replies: 4
    Last Post: 04-17-2009, 03:24 PM
  5. HELP ! about mod_rewrite
    By zapatista in forum Installation & Configuration
    Replies: 2
    Last Post: 03-24-2008, 03:04 PM

Posting Permissions

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