source: trunk/www.guidonia.net/wp/wp-content/plugins/permalink-validator/readme.txt@ 44

Last change on this file since 44 was 44, checked in by luciano, 15 years ago
File size: 10.1 KB
RevLine 
[44]1=== Plugin Name ===
2Tags: iis, redirect, 301, 404, permalink, wp_rewrite_rules, isapi, isapi_rewrite, rewriterule, htaccess, mod_rewrite, seo, url, www, canonical
3Requires at least: 2.0.0
4Tested up to: 2.6
5Stable tag: 0.8
6
7Validates the URL used and if not matching the official permalink then it issues a HTTP 301 or HTTP 404 message.
8
9== Description ==
10
11Wordpress 2.3 now includes validation of the permalink URL when using Apache web server,
12but if using IIS then this plugin is still relevant.
13
14Permalink Validator helps Search Engine Optimization (SEO) as it prevents duplicate
15contents on your Wordpress blog:
16
17* Adds trailing back-slash if missing (Can also be done with [htaccess](http://www.alistercameron.com/2007/01/12/two-wordpress-plugins-you-dont-need-and-shouldnt-use/) or [isapi_rewrite](http://cephas.net/blog/2005/07/11/trailing-slashes-iis-and-f5-big-ip/)).
18* Adds or removes www prefix according to your permalink structure (Can also be done with [htaccess](http://andybeard.eu/2007/04/the-ultimate-wordpress-htaccess-file.html) or isapi_rewrite).
19* Forces a correct 404 page instead of showing an empty search result when using an invalid URL
20* Works only on post, pages and categories. Archives based on date (Daily, Monthly, Yearly) and search-result-pages should use noindex. Feed and trackback pages should be added to the robots.txt.
21* Fixes pagination for WP on IIS.
22* Fixes trailing slash for pages and categories on WP 2.2 when not having trailing slash in post permalink structure.
23
24Wordpress it very forgiving when supplying an URL that doesn't match the
25actual permalink to a post or a page. This is caused by Wordpress using some
26very greedy wp\_rewrite\_rules, which accepts almost any URL as valid.
27
28This means that multiple URLs could be used to reach the page, which search engines
29sees a duplicate content and leads to penalty.
30
31For example it will accept the following permalink URL as valid:
32
33> http://example.com/post/hello-world/2
34
35Even though the official URL is this:
36
37> http://example.com/post/hello-world/
38
39Permalink Validator makes a hook to template_redirect, and then adds some
40extra validation of the URL supplied before actually calling the
41theme-templates.
42
43== Installation ==
44
451. Upload `permalink-validator.php` to the `/wp-content/plugins/` directory
461. Activate the plugin through the 'Plugins' menu in WordPress
47
48== Frequently Asked Questions ==
49
50= Why should I use this instead of htaccess or isapi_rewrite ? =
51If having the ability to use htaccess or isapi_rewrite, then one should continue
52to use these to add missing trailing back-slash or www prefix. They are a lot
53faster at redirecting than Permalink Validator, as they are activated without
54starting the PHP script engine when the URL has incorrect format.
55
56Permalink Validator extends the validation so besides checking the format,
57then it also checks that the url is referring to something valid. The validation
58of the url doesn't generate any extra overhead in database queries (unless the url requires redirection).
59
60= Why does it redirect continously when activating the plugin ? =
61The plugin makes a redirect when the url used to reach the page doesn't match the expected permalink url.
62Some times this leads to an endless loop, which Firefox shows as:
63
64> The page isn't redirecting properly <br/>
65> <br/>
66> Firefox has detected that the server is redirecting the request for this address in a way that will never complete. <br/>
67> * This problem can sometimes be caused by disabling or refusing to accept cookies. <br/>
68
69This can be caused by a conflict in the htaccess / isapi_rewrite redirection rules and the given permalink structure:
70
71* If enforcing trailing back-slash and the permalink structure doesn't include it.
72
73If this is not the case then you are very welcome to post a topic with your problem as feedback to this plugin.
74Please include your permalink-structure and Wordpress version in your description of the problem.
75
76= How to exclude pages from being permalink validated ? =
77The Permalink Validator will pretty much validate any URL you throw at it,
78but sometimes there are URL's that should not be validated.
79
80Edit the plugin-code and replace this line:
81
82> $excludes = array();
83
84With an array of the URL's to ignore:
85
86> $excludes = array("/forum");
87
88Plugins that requires an URL excluded:
89
90* [Subscribe to Comments](http://wordpress.org/extend/plugins/subscribe-to-comments/) - Exclude "/?wp-subscription-manager"
91* [wp-forum](http://wordpress.org/extend/plugins/wp-forum/) - Exclude "/forum"
92
93= How to block search engines from spidering Wordpress feed and trackback ? =
94Add the following lines to your [robots.txt](http://www.robotstxt.org/):
95
96> Disallow: \*/feed <br/>
97> Disallow: \*/atom <br/>
98> Disallow: \*/rss2 <br/>
99> Disallow: \*/rss <br/>
100> Disallow: \*/trackback <br/>
101> Disallow: /\*/feed <br/>
102> Disallow: /\*/atom <br/>
103> Disallow: /\*/rss2 <br/>
104> Disallow: /\*/rss <br/>
105> Disallow: /\*/trackback <br/>
106
107= How to make proper permalink URL's in IIS ? =
108Wordpress supports by default Apache htaccess and its mod_rewrite rules.
109When using Wordpress on IIS then these will not work and one is limited
110to this type of permalink:
111
112> http://example.com/index.php/post/hello-world/
113
114To remove the index.php, then one can either use the [custom 404 redirects](http://www.keyboardface.com/IIS-Permalinks/)
115or [isapi_rewrite](http://www.basilv.com/psd/blog/2006/running-wordpress-20-under-iis).
116
117If using isapi_rewrite and changing from using index.php to not using index.php,
118then one can use the following httpd.ini (Assumes Wordpress is installed in the root):
119
120>[ISAPI_Rewrite]<br/>
121>\# Rules to ensure that normal content gets through <br/>
122>RewriteRule /software-files/(.\*) /software-files/$1 [L] <br/>
123>RewriteRule /images/(.\*) /images/$1 [L] <br/>
124>RewriteRule /favicon.ico /favicon.ico [L] <br/>
125>RewriteRule /robots.txt /robots.txt [L] <br/>
126>
127>\# For file-based wordpress content (i.e. theme), admin, etc. <br/>
128>RewriteRule /wp-(.\*) /wp-$1 [L] <br/>
129>
130>\# Rule to perform 301 redirect to ensure trailing back-slash on post and pages <br/>
131>RewriteCond Host: (.\*) <br/>
132>RewriteRule ([^.?]+[^.?/]) http\://$1$2/ [I,R] <br/>
133>
134>\# Rule to perform 301 redirect (Remove index.php if specified) <br/>
135>RewriteRule /index.php/(.\*) /$1 [I,RP] <br/>
136>
137>\# For normal wordpress content, via index.php <br/>
138>RewriteRule ^/$ /index.php [L] <br/>
139>RewriteRule /(.\*) /index.php/$1 [L] <br/>
140
141= Why doesn't it redirect on IIS when the URL is wrong ? =
142Permalink Validator cannot see the difference between this url:
143
144> http://example.com/
145
146And this url on IIS:
147
148> http://example.com/index.php
149
150It can also not see the difference between this url:
151
152> http://example.com/
153
154And this url on IIS:
155
156> http://example.com/////
157
158This is because REQUEST\_URI is not supported properly on IIS, and this
159plugin can only simulate REQUEST\_URI to a certain limit. Therefore
160it is impossible to know whether index.php or extra slashes was specified or not.
161The solution is to use a rewrite engine like [ISAPI_rewrite](http://www.isapirewrite.com/)
162or [IIS mod-rewrite](http://www.micronovae.com/) as they can provide a proper REQUEST\_URI.
163
164= Why does a non existing page give HTTP error 200 on IIS ? =
165Microsoft IIS fails to reply with error code 404 in the HTTP header,
166when trying to access an non existing Wordpress page. This usually happens
167when using a custom 404 page on IIS.
168
169It seems that when using PHP on IIS, then it is not possible to reply
170with a proper HTTP header. Apparently the only way to return a proper
171404 on IIS is to use ASP.
172
173= Will Google tracking code work with this plugin ? =
174Google tracking code adds a question-mark (?) option to the URL, which the
175Permalink Validator will strip because it is not part of the permalink URL.
176
177Instead of using a question-mark (?), then one could use a hash (#) value,
178and then modify the Google tracking code to extract the hash value
179instead of the question-mark value.
180
181== Version History ==
182Version 0.8
183
184* Fixed PHP Warning: strpos() [function.strpos]: Empty delimiter
185* Converted the PHP file from UTF8 to ANSI (Removed special BOM character in file beginning)
186
187Version 0.7
188
189* Permalink Validator will not perform redirect of POST server request
190
191Version 0.6
192
193* Fixed a redirection bug introduced in 0.5 when the front page is a page of posts
194
195Version 0.5
196
197* Wordpress 2.3 includes permalink validation (canonical urls) when using Apache, so this plugin should now only be used with IIS
198* Added support for HTTPS urls
199* Added support for special IIS installations where PATH_INFO and SCRIPT_NAME is the same
200* Added small hack to exclude pages from validation (One is required to edit the source to use it)
201* Added detection of the plugin [Jerome's Keywords](http://vapourtrails.ca/wp-keywords)
202
203Version 0.4
204
205* Better guessing of a proper REQUEST\_URI
206* Finds the proper REQUEST\_URI when using isapi_rewrite
207* Finds the proper REQUEST\_URI when using IIS Mod-Rewrite
208* Improved validation as it nows expects a proper REQUEST_URI (Guess Apache is now supported)
209
210Version 0.3
211
212* Fixes trailing slash for pages and categories in WP 2.2 when using a post permalink structure without ending slash.
213
214Version 0.2
215
216* Added support for static front page.
217* Added detection of integrated [BBPress](http://bbpress.org/).
218* Checks that Wordpress has been started before adding hooks
219
220Version 0.1
221
222* Fixes REQUEST_URI for WP on IIS, which also fixes pagination.
223* Handles permalink structure with or without index.php.
224* Handles default permalink structure using only post-id.
225
226== Testing Procedures ==
227For each of the different permalink structures:
228
229* Default permalink structure (Using query string)
230* Permalink structure with index.php
231* Permalink structure without index.php (Using ISAPI_rewrite)
232* Permalink structure ending with .html
233* All the above in a sub-directory
234
235Tries the following pages:
236
237* Front page and paged
238* Static page
239* Post page
240* Category page and paged
241* Front page as static page (WP 2.2+)
242* Front page as post page (WP 2.2+)
243
244== Contributors ==
245* [Scott Yang](http://fucoder.com/code/permalink-redirect/) for giving me the idea and the example of to how make this plugin.
246* [Gabe Anderson](http://www.articulate.com/blog/) for giving me the initiative to release this plugin.
Note: See TracBrowser for help on using the repository browser.