WP htaccess Control - Version 1.5.4

Version Description

Download this release

Release Info

Developer andrad
Plugin Icon wp plugin WP htaccess Control
Version 1.5.4
Comparing to
See all releases

Code changes from version 1.5.3 to 1.5.4

readme.txt CHANGED
@@ -5,10 +5,10 @@ Plugin URI: http://dardna.com/wp-htaccess-control
5
  Donate link:
6
  Tags: permalinks, permalink, author, htaccess, rewrite, redirect
7
  Requires at least: 2.7
8
- Tested up to: 2.9.2
9
- Stable tag: 1.5.3
10
 
11
- Provides an interface to add custom htaccess rules to the htaccess file generated by Wordpress and customisation of the Author Permalink Base and of Paginated Permalinks.
12
 
13
  == Description ==
14
 
@@ -45,13 +45,17 @@ Provides an interface to add custom htaccess rules to the htaccess file generate
45
  == Frequently Asked Questions ==
46
 
47
  = Do you have any questions? =
48
- Suggestions are of course very welcome and please report any bugs found!
49
 
50
  == Screenshots ==
51
 
52
  1. Administration page (as of v.1.5)
53
 
54
  == Changelog ==
 
 
 
 
55
  = 1.5.3 (01/06/2010) =
56
  * Fix: small regex correction on filtered pagination links.
57
 
5
  Donate link:
6
  Tags: permalinks, permalink, author, htaccess, rewrite, redirect
7
  Requires at least: 2.7
8
+ Tested up to: 3.0
9
+ Stable tag: 1.5.4
10
 
11
+ Interface to add custom rules to the htaccess file generated by Wordpress and customisation of the Author Permalink and Pagination Permalinks.
12
 
13
  == Description ==
14
 
45
  == Frequently Asked Questions ==
46
 
47
  = Do you have any questions? =
48
+ Suggestions are welcome and please report any bugs found!
49
 
50
  == Screenshots ==
51
 
52
  1. Administration page (as of v.1.5)
53
 
54
  == Changelog ==
55
+ =1.5.4 (24/06/2010)=
56
+ * Fix: Setting canonical "www." will no longer be done by htaccess but simply by modifying "site url" and "home" options;
57
+ * Confirmed compatibility with WP 3.0.
58
+
59
  = 1.5.3 (01/06/2010) =
60
  * Fix: small regex correction on filtered pagination links.
61
 
wp-htaccess-control-ui.php CHANGED
@@ -173,7 +173,7 @@ $WPhtc_data=get_option('WPhtc_data');
173
  <option value="simple" <?php if($WPhtc_data['canon']=='simple'){echo "selected";} ?>><?php _e('Force non-WWW', 'wp-htaccess-control'); ?></option>
174
  </select>
175
  </td>
176
- <td valign="middle"><?php _e('This will force canonization.', 'wp-htaccess-control'); ?></td>
177
  </tr>
178
  </table>
179
  </div>
173
  <option value="simple" <?php if($WPhtc_data['canon']=='simple'){echo "selected";} ?>><?php _e('Force non-WWW', 'wp-htaccess-control'); ?></option>
174
  </select>
175
  </td>
176
+ <td valign="middle"><?php _e('This will force canonization. This will be done by simply modifying the wordpress "site url" and "home" options (not htaccess).', 'wp-htaccess-control'); ?></td>
177
  </tr>
178
  </table>
179
  </div>
wp-htaccess-control.php CHANGED
@@ -181,20 +181,28 @@ if (!class_exists("WPhtc")) {
181
  $domain=explode("/",$url);
182
  $escaped_domain=str_ireplace(".","\.",$domain[0]);
183
  if($WPhtc_data['canon']=='www'){
184
- $new_rules.="\n# WPhtC: Setting WWW canon\n";
185
- $new_rules.="<IfModule mod_rewrite.c>\n";
186
- $new_rules.="RewriteEngine On\n";
187
- $new_rules.="RewriteCond %{HTTP_HOST} ^".$escaped_domain." [NC] \n";
188
- $new_rules.="RewriteRule (.*) http://www.".$domain[0]."/$1 [R=301,L]\n";
189
- $new_rules.="</IfModule>\n";
 
 
 
 
190
  }
191
  else if($WPhtc_data['canon']=='simple'){
192
- $new_rules.="\n# WPhtC: Setting canon to non-WWW\n";
193
- $new_rules.="<IfModule mod_rewrite.c>\n";
194
- $new_rules.="RewriteEngine On\n";
195
- $new_rules.="RewriteCond %{HTTP_HOST} ^www\.".$escaped_domain." [NC] \n";
196
- $new_rules.="RewriteRule (.*) http://".$domain[0]."/$1 [R=301,L]\n";
197
- $new_rules.="</IfModule>\n";
 
 
 
 
198
  }
199
  }
200
  if($WPhtc_data['gzip']){
181
  $domain=explode("/",$url);
182
  $escaped_domain=str_ireplace(".","\.",$domain[0]);
183
  if($WPhtc_data['canon']=='www'){
184
+ $siteurl=get_option('siteurl');
185
+ if (!preg_match('/^http:\/\/www\./', $siteurl)) {
186
+ $siteurl=str_replace("http://","http://www.",$siteurl);
187
+ update_option('siteurl',$siteurl);
188
+ }
189
+ $homeurl=get_option('home');
190
+ if (!preg_match('/^http:\/\/www\./', $siteurl)) {
191
+ $homeurl=str_replace("http://","http://www.",$homeurl);
192
+ update_option('home',$homeurl);
193
+ }
194
  }
195
  else if($WPhtc_data['canon']=='simple'){
196
+ $siteurl=get_option('siteurl');
197
+ if (preg_match('/^http:\/\/www\./', $siteurl)) {
198
+ $siteurl=str_replace("http://www.","http://",$siteurl);
199
+ update_option('siteurl',$siteurl);
200
+ }
201
+ $homeurl=get_option('home');
202
+ if (preg_match('/^http:\/\/www\./', $siteurl)) {
203
+ $homeurl=str_replace("http://www.","http://",$homeurl);
204
+ update_option('home',$homeurl);
205
+ }
206
  }
207
  }
208
  if($WPhtc_data['gzip']){