IIRF + Which directory + Wordpress + rewrite URL for permalinks + total Newbie !!

Topics: Developer Forum
Jul 11, 2010 at 9:46 AM

Hello community

I am totally new here and just go introduced to IIRF. So, here is my problem / question:

I just got installed IIRF. I needed it to be able to create permalinks for my Wordpress blog.    My blog is reachable at the following : www.mysite.com/myblog

I need the change URLs only for "myblog" ONLY and not on my website.

I just received an email with the following : "The isapi filter dll is installed in your cgi-bin folder, and the ini file is in the same folder. The ini file must stay in this folder with the dll. There are a number of sample filters in the ini file, but all have been disabled except this one, for testing purposes..."

Then :"You can download the ini, make changes to it, and reupload to implement changes (and I believe the editor in the Control Panel's File Manager can probably allow you to edit it directly on the server). Changes made to the file are picked up real time. Do not move this file, or remove any other files from the cgi-bin directory. The loaded IIRF isapi filter looks for the ini file and other supporting files in the cgi-bin directory in the locations they are in now. "

SO, here are my questions ....

The cgi-bin folder is directly on the root of my site like : mysite.com/cgi-bin . I just read on StackOverflow.com that "cgi-bin historically was the only place where executable or script code (binaries, shell scripts, etc.) could be stored. It is mostly a historic relic since most hosts allow execution of scripts from anywhere."

 

Do I have to move the IIRF into my subdirectory wher my blog is ?

I need now to make the necessary steps to be able to modify my permalinks. I read that the famous  .htaccess file is useless in my case.

What do I have to do then ? I don't know where to start.

Does anybody is in a similar case as mine ?

Thank you for your guidance , any help will be precious,

Cheers,

 

Jul 14, 2010 at 7:35 AM
Edited Jul 14, 2010 at 7:49 AM
Hi,

The rules you need for this this are fairly simple, but first, do you have the isapi filter installed and working on your site? It sounds like your on a shared hosting websever so the server administrator woudl need to set it up, unless you can do it through a control panel.

Once setup the IIRF.ini file that contains the rules goes in the root of your website, and it has to have that name. IIRF looks for it there. It doesn't matter where the IIRF DLL is installed as long as IIS can read it.

You say they said the IIRF.ini is in the cgi-bin directory. I have not tried that, it might work. I guess try it and see.

My blog is in a sub-directory of my website and is named "/blog", so the rules I use are:

RewriteRule /blog/wp-content - [L]
RewriteRule /blog/wp-admin - [L]
RewriteRule ^/blog/index\.php/ /blog/index.php [I,L,U]
RewriteRule ^/index\.php/ /blog/index.php [I,L,U]
RewriteRule ^/blog/\? /blog/index.php [I,L,QSA]


These rules will work even if you don't have permalinks turned on. They also work if you have your index.php file in the root of your site (requires a special setting in Site address (URL) ).

I'm using WordPress 3.0 with IIS 5, but this should work with any version of IIS that runs IIRF. Also, I'm using IIRF v 2.0

------

> Do I have to move the IIRF into my subdirectory wher my blog is ?

No, as long as IIRF.dll loads and is running it's ok. The IIRF.ini file doesn't have to be in the same directory as the DLL (see above).

> I need now to make the necessary steps to be able to modify my permalinks. I read that the famous .htaccess file is useless in my case.

Yes, .htaccess is for Apache, not IIS.

First you need to set the rewrite rules in IIRF. Then turn on permalinks in the WordPRess settings. Then test to make sure it works.

> What do I have to do then ? I don't know where to start.

Start with the rules I gave above. If your blog is in a different subdirectory change "blog" to the name of your directory.

If you need to know about the rules I can explain what each one does and why it's there.

> Does anybody is in a similar case as mine ?

Yes, me.
Jul 16, 2010 at 8:03 AM

Hello Gardwell...I was so happy to find your message...I was feeling a bit alone with my filter . It seems that we are not a majority. Your answer is very clear and once I will spot the right file, I think I will be able to make my way through this filter mess.

SO,

I read carefully your reply , and looked for this IIRF.ini.

First I also saw that all files have been created not only on cgi-bin but also in a folder called isapifilter...I don't know why I have 2 similar folders ??!!

Inside each of these 2 folders I have the same files and folders such as readme's. and licenses plus a bin folder, a ExampleIni folder, a test folder , a bin folder and a lib folder....


In the ExampleIni folder it looks like the IIRF.ini file is not there, or is not named this way. I am thinking to rename one of them with the correct code...but as a beginner with .ini files, I want to be careful.

 Here are the bunch of ini files located in the folder called ExampleIni : (Did you have these files too ?)

ChainedRewriteCond.ini with the following code:

 

# ChainedRewriteCond.ini
#
# shows how to chain RewriteCond statements
#
# remember to rename this file to IsapiRewrite4.ini ,
# or copy this content to a file named IsapiRewrite4.ini
# before using it!
#
#
# Fri, 11 May 2007  12:44
#
 

RewriteLog  c:\temp\iirfLog.out
RewriteLogLevel 3

RewriteCond %{HTTP_URL}             (/|\.foo|\.htm|\.php|\.html|/[^.]*)$   [I]
RewriteCond %{REQUEST_FILENAME}     !-f                                    
RewriteCond %{REQUEST_FILENAME}     !-d                                    
RewriteRule ^.*$                    /winisp/info.aspx                      [U,I,L]


RewriteCond %{REQUEST_FILENAME}     !-f
RewriteRule ^.*$                    /winisp/surf.aspx                      [U,I,L]

RewriteCond %{APPL_PHYSICAL_PATH}   !-d                                    
RewriteRule ^.*$                    /winisp/info.aspx                      [U,I,L]


#RewriteCond %{HTTP_USER_AGENT}      ^Mozilla.*$
#RewriteRule ^.*$                    /winisp/info.aspx                      [U,I,L]

 

 

I have also CheckHttpHost.ini

 

# CheckHttpHost.ini
# 
# rewrite based on the HTTP_HOST used in the request.
#
# remember to rename this file to IsapiRewrite4.ini ,
# or copy this content to a file named IsapiRewrite4.ini
# before using it!
#
# Mon, 25 Sep 2006  15:42
# 

RewriteLog  c:\temp\iirfLog.out
RewriteLogLevel 5

#=====================================================
# Demonstrates RewriteCond with HTTP_HOST.
#
#=====================================================
RewriteCond %{HTTP_HOST} ^(?!www\.myhost\.org).*$ [I]
RewriteRule ^.*$ /redirected.htm [U,L]



A DetectFilesAndDirectories.ini


# DetectFilesAndDirectories.ini
#
# Shows how to use the "special patterns" for RewriteCond -
# for detection of files and directories.
#
# remember to rename this file to IsapiRewrite4.ini ,
# or copy this content to a file named IsapiRewrite4.ini
# before using it!
#
# Thu, 13 Jul 2006  15:11
#

RewriteLog  c:\temp\iirfLog.out
RewriteLogLevel 5

# ============================================
# This rule shows chaining of RewriteCond's.  
#
# The first RewriteCond checks the HTTP_URL.  if it ends in
# .foo, .htm, .php or .html, then it evaluates to TRUE.
#
# As per the description in the IIRF doc, successive RewriteCond
# statements are chained with a logical AND.
#
# Therefore, if the first RewriteCond evaluates to TRUE, then
# the 2nd will also be evaluated. The second statement tests
# whether the REWUEST_FILENAME is a file - actually in english
# the logical statement is "is the REQUEST_FILENAME NOT a file?"
#
# And the 3rd RewriteCond asks "Is the REQUEST_FILENAME NOT a
# directory?"
#
# In summary, then, the chain of RewriteCond directives
# evaluates to TRUE when, the URL includes the given suffix, and
# the REQUEST_FILENAME is neither a file nor a directory (file
# or directory does not exist). In that case, the RewriteRule is
# applied.
#
# ============================================

RewriteCond %{HTTP_URL}             (/|\.foo|\.htm|\.php|\.html|/[^.]*)$   [I]
RewriteCond %{REQUEST_FILENAME}     !-f                                    
RewriteCond %{REQUEST_FILENAME}     !-d                                    
RewriteRule ^.*$                    /index.php                             [U,I,L]



# ============================================
# This one detects if the physical path of the app exists.
# If not it redirects to default.aspx.
#
RewriteCond %{APPL_PHYSICAL_PATH}   !-d                                    
RewriteRule ^.*$                    /default.aspx                          [U,I,L]


# This
RewriteCond %{HTTP_USER_AGENT}   !-d                                    
RewriteRule ^.*$                    /winisp/info.aspx                      [U,I,L]



A Drupalrule.ini

# DrupalRules.ini
#
# from redamo
#
# remember to rename this file to IsapiRewrite4.ini ,
# or copy this content to a file named IsapiRewrite4.ini
# before using it!
#
# Fri, 11 May 2007  12:42
#



RewriteLog  E:\temp\iirfLog.out
RewriteLogLevel 3
RewriteFilterPriority HIGH
 
# Accept a url with the following directories and pass them through unchanged.
RewriteRule ^/misc/(.*)$ /misc/$1 [I,L]
RewriteRule ^/files/(.*)$ /files/$1 [I,L]
RewriteRule ^/modules/(.*)$ /modules/$1 [I,L]
RewriteRule ^/themes/(.*)$ /themes/$1 [I,L]
RewriteRule ^/sites/(.*)$ /sites/$1 [I,L]
RewriteRule ^/uploads/(.*)$ /uploads/$1 [I,L]
RewriteRule ^/css/(.*)$ /css/$1 [I,L]
RewriteRule ^/images/(.*)$ /images/$1 [I,L]
 
# for modules that provide their own js (tinymce,img assist etc)
RewriteRule ^(.*\.js)$ $1 [I,L]
RewriteRule ^(.*\.gif)$ $1 [I,L]
RewriteRule ^(.*\.png)$ $1 [I,L]
RewriteRule ^/modules/tinymce/(.*)$ /modules/tinymce/$1 [I,L]
 
# Make URLs sane
RewriteRule ^/cron\.php$ /cron.php [I,L]
RewriteRule ^/index\.php\?q\=(.*)$ /index.php?q=$1 [I,L]
RewriteRule ^/update\.php\?op\=(.*)$ /update.php?op=$1 [I,L]
RewriteRule ^/update\.php /update.php [I,L]
RewriteRule ^/xmlrpc\.php /xmlrpc.php [I,L]
 
RewriteRule ^/robots\.txt /robots.txt [I,L]
 
# Handle query strings on the end
RewriteRule /(.*)\?(.*)$ /index.php\?q=$1&$2 [I,L]
 
# now pass through to the generic handler
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/(.*)$ /index.php?q=$1 [I,L]


A PhpBlog.ini

# PhpBlog.ini
#
#
# This example shows how one user employed IIRF twith a
# PHP-powered blog engine.
#
# Remember to rename this file to IsapiRewrite4.ini ,
# or copy this content to a file named IsapiRewrite4.ini
# before using it!
#
# Note: The example here was contributed by someone who uses IIRF.
# I haven't tested this ini file, and I don't make any guarantees that
# it works as advertised  or expected or desired.  It's an example.
# Good luck! -Cheeso
#
# Fri, 11 May 2007  12:46
#

RewriteLog  c:\temp\iirfLog.out
RewriteLogLevel 3

# MaxMatchCount
#
# Specifies the maximum number of sub-expression matches to
# capture for a single pattern. This specifies the size of the
# array in the C module.  If you have a pattern with more than
# the default number of matches, set this number.
#
# The default is 10.

MaxMatchCount 10

#
# /content/blogcategory/0/33/
#
# should translate to
#
# /index.php?option=com_content&task=blogcategory&id=0&Itemid=33

RewriteRule ^/([^/]+)/([^/]+)/([^/]+)/([^/]+)/$  /index.php?option=com_$1&task=$2&id=$3&item=$4


AND FINALLY A ROUTEBASEDONHOSTNAME.INI
# RouteBasedOnHostname.ini
#
# Route based on hostname.
#
# Combines the use of server variables with the detection of
# files and directories, to do routing of requests.
#
#
# remember to rename this file to IsapiRewrite4.ini ,
# or copy this content to a file named IsapiRewrite4.ini
# before using it!
#
# Thu, 13 Jul 2006  15:11
#

RewriteLog  c:\temp\iirfLog.out
RewriteLogLevel 5

RewriteCond %{SERVER_NAME}          ([^\.]+)\.chiesa\.net$                [I]
RewriteCond c:\Inetpub\wwwroot\%1   !-d
RewriteRule ^(.*)$                  /NotFound.htm                         [U,I,L]

RewriteCond %{SERVER_NAME}          ([^\.]+)\.chiesa\.net$                [I]
RewriteCond c:\Inetpub\wwwroot\%1   -d
RewriteRule ^(.*)$                  /common/driver.aspx?url=$1&host=%1      [U,I,L]





I feel that the ChainedRewriteCond.ini could be the one...but I am not sure. This is ridiculously complicated and confusing. I am so pissed of with this Apache story / .htaccess.

Thank you for reading all this, I am sorry for th lenght of this post, but I thought you should have the all things...
Cheers,









 

 

Jul 16, 2010 at 12:12 PM
Edited Jul 16, 2010 at 12:15 PM

Hi rozenn,

ok, calm down.

we can get this sorted out.

I don't know why you have a "isapifilter" either.  It's probably something left over from your host.

This is the folder structure I have:

 

/3rdParty

/AdminGuide

/AdminGuide/Help

/bin

/ExampleIniFiles

/tests

/tests/{a bunch of folders}

License.IIRF.txt

Readme.txt

ReleaseNotes.txt

 

Most of these can be ignored.

 

Under the help folder is file called IirfGuide.chm.  Thats the documnetation for IIRF.  If you don't have it there it's also on the downloads page.

I reread the letter your host sent you and upon considering it since IIRF is open source they may have modified it for their purposes.  To see if they've done this, could you post the ini file they refer to?  I can tell which it is by looking at it's contents.  Also, what is it's full name?

After I see that file I'll have some idea how to proceed.

Jul 17, 2010 at 9:14 AM

Hello Gardwell !!

Well, confusing still confusing...

We'll have to hold on to it for a white as I requested my host to clarify this folder story.

I checked into both duplicated cgi-bin and isapifilter folders...annd guess what ?? there is no isapi filter dll  installed in my cgi-bin folder (neither in isapifilter main folder).

Among all files...nothing called this way. So may'be it is there, but under another name.

 

Messy. Too messy.

I let my host figure it out with his contact in USA ( who apparently installed the stuff),

I hope it will work.

 

So...I et you know asap.

Thank you so much Gardwell...you're so very kind and patient...

 

Have a nice Saturday wherever you are !

Cheers

Jul 22, 2010 at 8:55 AM

Hello Gardwell,

I am back with my Isapi ...This one will never let me down.

So Finally the Isapifilter.ini has been spotted !!!

The IsapiRewrite4.ini is together with the IsapiRewrite4.dll

So the basic location of my filter and the blog are as following :

www.website.com/my-blog

www.website.com/cgi-bin/lib/IsapiRewrite4.ini

 

I applied your all rule and changed it to my convenience  as follow

RewriteRule /my-blog/wp-content - [L]
RewriteRule /my-blog/wp-admin - [L]
RewriteRule ^/my-blog/index\.php/my-blog/index.php [I,L,U]
RewriteRule ^/index\.php/ my-blog/index.php [I,L,U]
RewriteRule ^/blog-des-maldives/\? /my-blog/index.php [I,L,QSA]

 

It does not work. I also tried various rules from various posts and blogs...Nothing.

I was just reading our first 2 posts.

As I mentionned, on the email I initially received, it says the isapi filter dll is installed in your cgi-bin folder( exact path : cgi-bin/lib), and the ini file is in the same folder. The ini file must stay in this folder with the dll.

And you wrote me that The IIRF.ini file doesn't have to be in the same directory as the DLL

I am so confused...

 

I wonder if anybody from the IIRF is checking the forum sometimes...Thanks god you are tehre beacuse their support team is INEXISTANT. This is not serious.

Jul 22, 2010 at 8:57 AM

I am battling with this IIRF filter for days and days now !!!! NOBODY FROM IIRF OR MICROSOFT TO HELP ?????? This is frankly very odd nowadays.

 

Jul 28, 2010 at 3:49 PM
Edited Jul 28, 2010 at 3:51 PM

rozenn,

Create an IsapiRewrite4.ini file with the following content:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule /myblog/. /myblog/index.php [L,QSA]

Upload this file to your webhost in the /cgi-bin/lib/ folder. Overwrite the existing IsapiRewrite4.ini file. Make sure the IsapiRewrite4.dll file is still there. If not, check with your webhost if you're uploading to the right folder or let them check whether the filter is still working properly.

Next, logon to your WordPress installation. Click to 'Permalinks' and set the option to 'Custom Permalinks Structure'. Insert /%postname%/ as value. Now save the settings and things should work fine.

Let me know how this works out.

 

Jul 29, 2010 at 8:53 AM
Hi sAnexeh Txx for passing by Yes I did all that. Turned and twisted the rules... But it looks that the filter is not properly installed + the webhost installed a version from oct 2008 :-( ... Cheeso advised me to install the v2. I am now waiting news from the webhost. Looooooooooooooooonnng story. Thanks you again, I am crossing my fingers Cheers,