This forum has been moved here:
Helicon Tech Community Forum

ISAPI_Rewrite 3.0 (Forum Locked Forum Locked)
 Helicon Tech : ISAPI_Rewrite 3.0
Subject Topic: ISAPI ReWrite with Wordpress 3.2 on IIS6
Author
Message |
smithy73
Newbie


Joined: 11 August 2011
Posts: 2
Posted: 11 August 2011 at 8:23am

Hi, I am having problems getting the rewrite to work on a Wordpress 3.2 blog on a server running IIS6. I have installed the ISAPI 3.0 lite and therefore using the httpd.conf file and added the rewrite code as specified in the instructions.  

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(\d+)/[^/]+/?$ index.php?p=$1 [NC,L]

The ReWrite Cond lines work, as I can see the blog's homepage OK, but if I try to access a blog entry, I get a 404 error page.

If I add /index.php/ to the URL of every blog entry, then it works fine, so I guess the rewrite rule is not working. 

Has anyone experienced this problem and if so found a solution?

Thanks

Back to Top
 
millers4
Newbie


Joined: 09 February 2008
Posts: 16
Posted: 12 August 2011 at 5:54am

I came onto the forum to ask the very same question. I have the full version v3 and in my .htaccess I have

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(\d+)/[^/]+/?$ index.php?p=$1 [NC,L]

If I use a permalink structure as /index.php/%postname%/ then my website quite happily works with

www.mysite.com/index.php/something/

but I don`t want the index.php in the url

but the permalink /%postname%/ breaks the website

Any ideas how to remove it?

Thanks
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 15 August 2011 at 5:18am

Gentlemen, you need to take a look at the following article

smithy73 Try to specify the permalink structure as show in the article

millers4, in case you use permalink /%postname%/, then you need to modify the rule as following:

Code:
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/?$ index.php?p=$1 [NC,L]


Regards
Andrew
Back to Top
 
millers4
Newbie


Joined: 09 February 2008
Posts: 16
Posted: 16 August 2011 at 3:18am

Thanks for the link Andrew, makes a lot of sense but unfortunately I still can`t figure out how to make this work.

The rule you provided works for one level i.e.

www.mysite.com/level1/

but not for levels further than that for child pages to that

www.mysite/level1/level2/

the site will have a maximum of 4 levels.

How do I rewrite the rule to work for all levels?

Thanks

edit: just looked in error.log and there is nothing pertaining to my problem, allI have is

[16/08/2011 09:16:37] ISAPI Filter loaded. Version 3.1.0.78. Windows 6.1 (Build 7600 ServicePack:0) ProductType SERVER. CPU type INTEL  NumberOfProcessors 8.


Edited by millers4 - 16 August 2011 at 3:20am
Back to Top
 
smithy73
Newbie


Joined: 11 August 2011
Posts: 2
Posted: 17 August 2011 at 5:08am

Thanks Andrew.  We have followed the article point by point and no luck.  Although the article points to Wordpress 2.6.2 and as mentioned the latest version is 3.2 (actually 3.2.1 now) so not sure if that makes a difference.

Can someone from Helicon confirm whether the ISAPI ReWrite works with the latest version of Wordpress?

Thanks

Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 17 August 2011 at 5:36am

millers4, so it works! good.
Your rules depends on the four levels that you may. I do not know the structure

You may try:

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^[^/]+/([^/]+)/?$ index.php?p=$1 [NC,L]

It's work if you have www.mysite/XXXXXX/postname/. Using these two you can make 3 and 4-level-rules.

Regards
Andrew
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 17 August 2011 at 5:40am

smithy73, as you can see millers4 has it running on Wordpress 3.
There won't be much difference in URLs in 3.2.1, I suppose.
Please, check the permissions.
You may also want to run some testing rules, provided in the FAQ and see the error.log and rewrite.log

You may need to have an RDP with one of Helicon spesialist or use Premium Support Plan to figure out the issue.

Regards
Andrew
Back to Top
 
millers4
Newbie


Joined: 09 February 2008
Posts: 16
Posted: 18 August 2011 at 10:39am

AndrushkaUS wrote:
millers4, so it works! good.
Your rules depends on the four levels that you may. I do not know the structure

You may try:

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^[^/]+/([^/]+)/?$ index.php?p=$1 [NC,L]

It's work if you have www.mysite/XXXXXX/postname/. Using these two you can make 3 and 4-level-rules.

Regards
Andrew


Still struggling to get it to work on more than 1 level,

RewriteRule ^([^/]+)/?$ index.php?p=$1 [NC,L]  - works great on one level www.mysite.com/something/ but on pages a level deep www.mysite.com/something/other/ it 404's

The rule
RewriteRule ^[^/]+/([^/]+)/?$ index.php?p=$1 [NC,L] doesn`t work at all and 404's on all levels
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 19 August 2011 at 6:05am

It must work only for 2 level URLs.What URL do you request?
Back to Top
 
millers4
Newbie


Joined: 09 February 2008
Posts: 16
Posted: 19 August 2011 at 8:24am

The site has upto four, so all four need to work i.e.

www.mysite.com/something/
www.mysite.com/something/another/
www.mysite.com/something/another/extra/
www.mysite.com/something/another/extra/final/

Thanks for the help
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 22 August 2011 at 4:53am

Basically,

Quote:
www.mysite.com/something/
www.mysite.com/something/another/
www.mysite.com/something/another/extra/
www.mysite.com/something/another/extra/final/


are equal to:

Code:
RewriteRule ^[^/]+/?$ index.php?p=$1 [NC,L]
RewriteRule ^([^/]+)/[^/]+/?$ index.php?p=$1 [NC,L]
RewriteRule ^([^/]+)/[^/]+/[^/]+/?$ index.php?p=$1 [NC,L]
RewriteRule ^([^/]+)/[^/]+/[^/]+/[^/]+/?$ index.php?p=$1 [NC,L]


Regards
Andrew
Back to Top
 
millers4
Newbie


Joined: 09 February 2008
Posts: 16
Posted: 22 August 2011 at 6:05am

Unfortunately these rules then knock out the admin and also includes stop working such as the stylesheet, js files etc that are a few levels into the structure.

This is my first time I have implemented a wordpress website on iis, isapi rewrite and windows, using an apache route the rule is simply

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

which works perfectly, all levels work as intended and it doesn`t interfere with includes.
Back to Top
 
millers4
Newbie


Joined: 09 February 2008
Posts: 16
Posted: 22 August 2011 at 8:27am

I think I am getting closer but to simplify the thread, here is where I am:

Now I usually put wordpress sites on linux servers and use a simple .htaccess reg exp

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

that allows me to use the permalink /%postname%/ which no matter how many levels deep will display the permalink correctly and also allow the admin to work.

Using isapi we have

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^[^/]+/?$ index.php?p=$1 [NC,L]

but this only works for 1 level i.e. www.site.com/something/

The site has upto 4 levels so I now have

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^[^/]+/?$ index.php?p=$1 [NC,L]
RewriteRule ^([^/]+)/[^/]+/?$ index.php?p=$1 [NC,L]
RewriteRule ^([^/]+)/[^/]+/[^/]+/?$ index.php?p=$1 [NC,L]
RewriteRule ^([^/]+)/[^/]+/[^/]+/[^/]+/?$ index.php?p=$1 [NC,L]

This displays the pages but messes up the stylesheets, .js files etc as they all come out as 404's.

Also, the admin doesn`t work as this also goes to a 404.

Is there any way to make the rules ignore anything that contains wp- so that the admin works (wp-admin) and the outward facing website can still find wp-content and wp-includes?

Thanks
Back to Top
 
millers4
Newbie


Joined: 09 February 2008
Posts: 16
Posted: 12 October 2011 at 5:42am

Apologies for rehashing this old thread, but now I have almost finished the website and am back loking at the permalinks.

My script in the post above didn`t quite work as it 404'd on all files in the site, so I came up with a much simpler script which works perfectly for the user front end, but some admin pages 404.

Here is what I now have

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* /index.php [L]

It works great for the user front end
The dashboard works fine at /wp-admin/

BUT any other admin pages such as list pages '/wp-admin/edit.php?post_type=page' gives a 404.

Is it possible to tell my script above to ignore anything with wp-admin? In theory that should then work exactly as I need it to.

Thanks again
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 12 October 2011 at 7:40am

Please, try using:

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/wp-admin/.*
RewriteRule .* /index.php [L]


Regards
Andrew
Back to Top
 
millers4
Newbie


Joined: 09 February 2008
Posts: 16
Posted: 13 October 2011 at 5:04am

That worked perfectly thank you
Back to Top
 
brian47374
Newbie


Joined: 07 March 2012
Location: United States
Posts: 2
Posted: 07 March 2012 at 8:06pm

I have posted a similar issue here;
http://www.helicontech.com/forum/19132-
Installed_but_not_working.html

I am running WordPress 3.3.1 on IIS6 x64 bit. I am
running ISAPI Lite.

I tried following documentation but I am unsuccessful at
getting the Pretty URLs to work.

RewriteRule .? - [F]

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/?$ index.php?p=$1 [NC,L]

All of those lines are in my httpd.conf file under RW
ISAPI_Rewrite. Yet they are not working.

I am trying to use /%postname%/ for cleaner URLs.

http://www.helicontech.com/forum/10648-FAQ.html
http://www.helicontech.com/cms_articles/wordpress.htm

This option may not always work, especially in cases of
WordPress running on IIS 6. To make this option work on
IIS, add these 2 lines to a php.ini file and store that
file in your webroot :
cgi.fix_pathinfo = 1
cgi.force_redirect = 0

Another solution exists using IIS' custom 404 redirects.
It requires that your web host allows you to add a custom
404 redirect, but it doesnt require you to install any
3rd party mod_rewrite software and it also doesn't
require that your permalink structure begin with
/index.php/

http://codex.wordpress.org/Using_Permalinks

I am a bit confused with this documentation right from
wordpress site. Are they telling me that I need to create
a php.ini file and put those two lines in the file and
that will solve my issues?

What is with the permalink structure beginning with
/index.php/ ?

Thanks,

Brian
Back to Top Visit brian47374's Homepage
 

Sorry, you can NOT post a reply.
This forum has been locked by a forum administrator.

Printable version Printable version