Opened 16 years ago
Last modified 4 weeks ago
#10425 assigned enhancement
Improvements to IIS7 Rewriting Code
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | low |
Severity: | normal | Version: | 2.8.1 |
Component: | Permalinks | Keywords: | has-patch needs-refresh close |
Focuses: | Cc: |
Description
#8974 introduced a set of functions and changes which allow to automatically generate Rewrite Rules for Wordpress installs running on IIS7.
There are some issues with that implementation that I think are worth being written down and discussed somewhere so here we go:
1) There's no "Verbose" option for IIS rules; while I can't say when it would make sense to have a verbose listing of all WordPress rewrite rules in .htaccess
/web.config
it might be something that should be available for both systems?
2) IIS does not add non wordpress rules ($non_wp_rules
) to the web.config
file (iis7_url_rewrite_rules()
) which means that any custom rewriting which plugins/users can do on apache don't work on IIS.
3) At the moment it's assumed that there is only ONE single rule needed for IIS. Especially when looking at the merge with WPMU this is going to become a problem because WPMU uses multiple rules. Every rule has to have a unique name and functions like iis7_rewrite_rule_exists()
and iis7_delete_rewrite_rule()
only look for one rule with name "wordpress". Custom Rules (see 2) also won't work without a change here. For a partial fix see misc.php in Patch on MU #991)
Any comments?
Attachments (1)
Change History (16)
#2
@
16 years ago
- What is the use of the Verbose option?
- I think a plugin can add non-WordPress rules via the iis7_url_rewrite_rules filter. The $non_wp_rules was designed for Apache mod_rewrite and those rules cannot be used in IIS.
- It looks like using starts-with(@name,'wordpress') is good solution.
#3
follow-up:
↓ 5
@
16 years ago
After more investigation I do not think that support for verbose rules should be added to IIS specific code. It is still not clear to me whether verbose rules option is ever used. Manually enabling it on Apache causes WP to generate about 70 mod_rewrite rules in .htaccess file. I do not understand why it is needed, as the only rule that is required for pretty permalinks to work is the rule to rewrite everything to index.php. In addition to that, having so many rules in either .htaccess file or in web.config file may degrade the performance of the web server.
#5
in reply to:
↑ 3
@
16 years ago
- Keywords reporter-feedback close removed
Replying to ruslany:
After more investigation I do not think that support for verbose rules should be added to IIS specific code. It is still not clear to me whether verbose rules option is ever used. Manually enabling it on Apache causes WP to generate about 70 mod_rewrite rules in .htaccess file. I do not understand why it is needed, as the only rule that is required for pretty permalinks to work is the rule to rewrite everything to index.php. In addition to that, having so many rules in either .htaccess file or in web.config file may degrade the performance of the web server.
I agree that it does not seem to make much sense; maybe the option for "verbose rules" should just be removed completely then? (clean-up?)
2) I'll need to better understand how non_wp_rules work. Do you have an example of such rule? Or may be a plugin that uses those rules.
No, I don't know if anyone actually uses it; I only stumbled on it myself when writing the patch for MU #991. It was introduced with the initial patch in #2433/[3638] (Dez 2006) and has not been touched since.
#6
@
16 years ago
I just stumbled on another issue that should be considered when/if someone starts work on this issue.
WP SuperCache uses the .htaccess
file to enable things like "gzip compression". I think it might be possible to do a similiar thing on IIS (see config value httpCompression). Adding these config values would of course be the job of WP SuperCache but the core functions would need to provide support for adding arbitrary config values. At the moment only "rewrite rules" are possible as far as I know.
#7
follow-up:
↓ 9
@
15 years ago
Are there any core functions in WP that WP Super Cache uses to write arbitrary configuration settings into .htaccess file? If there is none then I do not think there is a need to add any functions for generic IIS config management. As was mentioned already, it should be responsibility of the WP Super Cache to write any new config settings into the IIS config file.
#9
in reply to:
↑ 7
@
15 years ago
Replying to ruslany:
Are there any core functions in WP that WP Super Cache uses to write arbitrary configuration settings into .htaccess file? If there is none then I do not think there is a need to add any functions for generic IIS config management. As was mentioned already, it should be responsibility of the WP Super Cache to write any new config settings into the IIS config file.
WP Super Cache will be using the mod_rewrite_rules
filter to add extra rules to the .htaccess file.
For the IIS7 style rewrites we have the iis7_url_rewrite_rules
filter where SuperCache could add the extra rules.
As for the Verbose Rules that is a different issue.
If you look at the WP_Rewrite::mod_rewrite_rules
function you will see a block or code wrapped in a check for if ($this->use_verbose_rules)
this code block is triggered if someone manually enables it and writes out all the rules as individual mod_rewrite rules instead of using the internal rewriter - not sure if this can be automated for IIS7?
Is does look like support for the $non_wp_rules
in IIS7 would be nice if possible.
#11
@
13 years ago
- Keywords has-patch dev-feedback added
Two-year refresh. Core devs and bug reporters: Is this bug still relevant? If it is, could you guys please take some action on this bug.
#15
@
4 weeks ago
- Keywords close added; dev-feedback removed
- Milestone set to Awaiting Review
I came across this ticket going through ones missing a milestone.
When this was created, IIS market share was sitting around 20-30%. A lot has changed, and this number now sits at roughly 4% with less than 0.4% of all WordPress sites now using Windows-based hosting.
I'm going to add a close
suggestion to allow time for any additional feedback, but I think this (and other IIS enhancements) can probably be closed out as wontfix
.
1) Does the verbose rules options ever get used? It looks like in the rewrite.php file it is hardcoded to be off.
2) I'll need to better understand how non_wp_rules work. Do you have an example of such rule? Or may be a plugin that uses those rules.
3) This should be fixed. I'll try to spend some time on preparing a patch for this.