redirect all traffic to one file

Topics: Developer Forum, User Forum
Sep 29, 2009 at 8:38 PM
Edited Sep 29, 2009 at 8:40 PM


i have a website im trying to get optimized for search engines.
basically the entire site is run from one file. all the pages are dynamic
and it currently uses querystrings to create pages. im ready to get rid
of the querystrings all together. but im not really conserned about
having IIRF pulling values out of the url and rewriting them as query
strings in the background, i can update my scripts so they can read
the url and parse out the values from the url.

i have done this using mod_rewrite like so...

RewriteEngine on   
RewriteCond %{REQUEST_FILENAME} !-f   
RewriteCond %{REQUEST_FILENAME} !-d   
RewriteRule ^(.*) /index.php?__key__=$1 [L,QSA]  

but im having no luck doing this w/ IIRF.

the other thing, is i have one REAL folder that i want to serve
normally (its all images)

is really
is really that url.

can you guys give me some tips?
thanx a lot!

Sep 29, 2009 at 10:13 PM
xero wrote:

...but im having no luck doing this w/ IIRF.

Ok, it's not working.  

What else do you know?  What have you done to troubleshoot this?  Does IIRF start up successfully?  Have you looked in the IIRF log file?  What does the IirfStatus URL say?  

The thing you described with the images is normally handled by the RewriteCond with the negated -f flag.  It says "only fire this following URL if the file doesn't exist."  If the image file actually exists, it will be served as is.



Sep 30, 2009 at 4:18 PM

hey cheeso,
i got things fixed on the server side today.
im running a modified version of your
"clean urls" example script and its working perfectly.

# IsapiRewrite4.ini
# ini file for IIRF

RewriteLogLevel 4
RewriteLogFile c:\temp\iirf

RewriteEngine ON
StatusUrl /iirfStatus

IterationLimit 5

# this will allow ugly URLs to not be processed at all
RewriteRule ^/moonworld/index.php(.*)$ - [L,I]

# do not rewrite requests for stylesheets or image files
RewriteCond %{REQUEST_FILENAME} -f  
RewriteRule ^/.*$          -     [L]

# this is the rule the does the work. It rewrites everything
# else to +arguments+
RewriteRule ^/moonworld/(.*)$ /moonworld/?$1 [L]

here's the problem.
im running this on our development server.
which has tons of folders leading to test versions of sites.
eventually these will all get subdomains on our production
server, or their own domains.

looking at the IIRFstatus i see my INI is located at:

so that means this rule set is being applied to the entire
development server! so my question is:

is there a way to run multiple rule sets on one server?
or will i need to somehow merge multiple site rule sets into one INI???

basically i want to run the same clean url script across the board.
i need all real files (imgs, css, js, etc) to serve as normal (urls not rewritten)
and i want to push everything else to /index.php in their directorys.
so the left side urls will rewrite to the right side ones, >> >> >>
(these urls are examples, i need a ruleset generic enough for any of these and more)

can you help me write a rule set like that???


Sep 30, 2009 at 5:09 PM

IIRF v2.0, which is still classified as "beta" but is very reliable, lets you specify a different ini file for each virtual directory.

Check the doc for more on that.