Forum Moderators: open

Message Too Old, No Replies

Problem with Ispai rewrite and wordpress

Calling all Isapi Rewrite Experts

         

mrsolutions

5:36 pm on Nov 4, 2006 (gmt 0)

10+ Year Member



I'm trying to get friendly permalinks to work on my IIS windows hosted blog.

I have ISAPI rewriter installed and have placed the following in the httpd.ini in the /wwwroot/ directory.

My blog located on domain.com/news

I had my host restart ISS for the changes to take effect but nothing works...

Here is the code I am using.

------------------

# Rules to redirectd domain.com to www.domain.com
RewriteCond Host: ^domain\.com
RewriteRule (.*) http\://www\.domain\.com$1 [I,RP]

# Rules to ensure that normal content gets through
RewriteRule /news/software-files/(.*) /news/software-files/$1 [L]
RewriteRule /news/images/(.*) /news/images/$1 [L]
RewriteRule /news/favicon.ico /news/favicon.ico [L]

# For file-based wordpress content (i.e. theme), admin, etc.
RewriteRule /news/wp-(.*) /news/wp-$1 [L]
RewriteRule /news/xmlrpc.php /news/xmlrpc.php [L]

# For normal wordpress content, via index.php
RewriteRule ^/news/$ /news/index.php [L]
RewriteRule /news/(.*) /news/index.php/$1 [L]

--------------

The permalink structure I am using is simply %%postname%%
However all links to posts and categories 404.

The domain does not also redirect from domain.com to www.domain.com as it should.

Does anyone know is there something I am doing wrong or something that could be causeing the problem?

pageoneresults

6:15 pm on Nov 4, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You may want to try posting your question at the ISAPI_Rewrite forums for a quicker response.

defanjos

6:11 am on Nov 6, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Make sure you place the httpd.ini file in the root of the web site itself.

If it still does not work, make sure to have an entry for "Everyone" with "read" capabilities under properties>security for that httpd.ini

mrsolutions

11:24 am on Nov 6, 2006 (gmt 0)

10+ Year Member



defanjos:

Does that mean I should have it below the /wwwroot/ directory, (i.e below the public-html directory)?

By giving permissions to everyone to you mean CHMOD 666 the http.ini file?

defanjos

3:07 pm on Nov 6, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Keep the file where the index or default file is kept (file for the home page).

By giving permissions to everyone to you mean CHMOD 666 the http.ini file?

You said it was a windows server, i don't think you have CHMOD 666. On a windows server, if you right click on the file, you should see a security tab. Create a user "Everyone", and check "read" permissions.
But, maybe you don't have to do this. First make sure the file is in the correct location.

btw, you don't have to re-start the server. Simply upload the file into the correct location. Even if you make a change, just upload the new version of the httpd.ini file.

pageoneresults

3:46 pm on Nov 6, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Do you have an httpd.ini file at the root level of the server. You need the master .ini file installed at the root of the server and then you can install .ini files for each website on that server.

mrsolutions

4:43 pm on Nov 6, 2006 (gmt 0)

10+ Year Member



I have the httpd.ini file in the same place as my site root (same place as index.php page).

The file was in the right location and still did not work.

You said it was a windows server, i don't think you have CHMOD 666. On a windows server, if you right click on the file, you should see a security tab. Create a user "Everyone", and check "read" permissions.

Yes it is a Windows server. I did not realize it does not have a CHMOD option as I'm used to using Linux servers.

I am using Dreamweaver to upload and manage files, I cant see a security tab anywhere? How do I change the security settings?

Do you have an httpd.ini file at the root level of the server. You need the master .ini file installed at the root of the server and then you can install .ini files for each website on that server.

I am on a shared server and they have ISAPI Rewrite enabled and set up. I placed the http.ini file within my root directory (same as my index.php page) but it does not work.

defanjos

4:51 pm on Nov 6, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ask your hosting company to give "Everyone" read permissions for the file. You cannot do it without access to the server.

defanjos

4:56 pm on Nov 6, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I just noticed, you are missing the following at the top of your httpd.ini file:

[ISAPI_Rewrite]

It should be:

[ISAPI_Rewrite]

# Rules to redirectd domain.com to www.domain.com
RewriteCond Host: ^domain\.com
RewriteRule (.*) http\://www\.domain\.com$1 [I,RP]

# Rules to ensure that normal content gets through
RewriteRule /news/software-files/(.*) /news/software-files/$1 [L]
RewriteRule /news/images/(.*) /news/images/$1 [L]
RewriteRule /news/favicon.ico /news/favicon.ico [L]

# For file-based wordpress content (i.e. theme), admin, etc.
RewriteRule /news/wp-(.*) /news/wp-$1 [L]
RewriteRule /news/xmlrpc.php /news/xmlrpc.php [L]

# For normal wordpress content, via index.php
RewriteRule ^/news/$ /news/index.php [L]
RewriteRule /news/(.*) /news/index.php/$1 [L]

mrsolutions

6:15 pm on Nov 6, 2006 (gmt 0)

10+ Year Member



Thanks defanjos!

That has solved part of the problem.

The domain redirects from: domain.com to www.domain.com now as it should.

However the blog urls do not load properly.

The blog structure is:
[domain.com...]
this page loads clearly but links to individual posts and categories etc do not work.

Individual posts should be as below, but this 404s.
[domain.com...] title/

My settings in wordpress for permalink structure are simple: /%postname%/

I am following this guide: [basilv.com...]

pageoneresults

7:06 pm on Nov 6, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Try using absolute URIs...

# For normal wordpress content, via index.php 
RewriteRule ^/news/$ http://www.example.com/news/index.php [L]
RewriteRule /news/(.*) http://www.example.com/news/index.php/$1 [L]

mrsolutions

7:14 pm on Nov 6, 2006 (gmt 0)

10+ Year Member



Thanks for your help pageone

Unfortunately absolute urls did not work, and it even made the root address of the blog (www.domain.com/news/) 404 as well.

defanjos

8:24 pm on Nov 6, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That has solved part of the problem.

I am curious, probably adding the [ISAPI_Rewrite] part, correct?

defanjos

8:36 pm on Nov 6, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I am not that good at writing rules, but your rules don't make sense. For example:
RewriteRule /news/images/(.*) /news/images/$1 [L]

You are telling the rewrite engine to serve the page /news/images/page1 with exacly the same page /news/images/page1
I don't get it

As mentioned before, try the isapi_rewrite forum

mrsolutions

9:10 pm on Nov 6, 2006 (gmt 0)

10+ Year Member



Thanks for your help so far defanjos :) In answer to your questions:

I am curious, probably adding the [ISAPI_Rewrite] part, correct?

Yes that solved the domain.com redirecting to www.domain.com

I am not that good at writing rules, but your rules don't make sense. For example:
RewriteRule /news/images/(.*) /news/images/$1 [L]

You are telling the rewrite engine to serve the page /news/images/page1 with exacly the same page /news/images/page1
I don't get it


I dont really know too much about ISAPI Rewrites. I am simply following this guide: [webmasterworld.com...]

As mentioned before, try the isapi_rewrite forum

I have done - not too much luck there either...

I think it could possibly be to do with the php.ini file in the web root.
The php.ini file contains:
cgi.fix_pathinfo = 1
cgi.force_redirect = 0

The reason I beleive it is to do with the php.ini file is that it had no effect when I tried a different permalink structure with the wordpress blog, however this same permalink structure worked on an old server just fine with just the php.ini file (no Isapi rewrite).