1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

mod_rewrite trouble

Discussion in 'HTML, Graphics & Programming' started by toastyman, 2 Jan 2010.

  1. toastyman

    Gangster

    Joined: 30 Dec 2005

    Posts: 421

    Hi all,

    Having a few issues with the following mod_rewrite statements..
    Code:
    RewriteCond ^app/wwwroot$%{REQUEST_FILENAME} -d
    RewriteCond ^app/wwwroot$%{REQUEST_FILENAME} -f
    RewriteRule ^(.*)$ app/wwwroot/$1 [L]
    	
    RewriteRule ^(.*)$ app/wwwroot/index.php?url=$1 [QSA,L]
    
    So the idea is that if a physical file existed then the user would be pointed to that. For example, a file at app/wwwroot/images/add.jpg could be access at http://localhost:8082/images/add.jpg.

    If the file or folder doesn't exist then it should redirect to the php file. Eg. if you visit http://localhost:8082/test it'll point to app/wwwroot/index.php?url=/test.

    However, at the moment all requests are going to the index.php file, which implies that the rewrite conditions aren't working. Does anyone have any ideas what the issue is?

    Thanks!
     
    Last edited: 2 Jan 2010
  2. suarve

    Mobster

    Joined: 8 Oct 2005

    Posts: 4,190

    Location: Midlands, UK

    Have you set a rewritebase? Is this failing to work working locally and on the internet?