404 to 301 - Version 1.0.0

Version Description

  • Added first version with basic options.

=

Download this release

Release Info

Developer joelcj91
Plugin Icon 128x128 404 to 301
Version 1.0.0
Comparing to
See all releases

Version 1.0.0

Files changed (4) hide show
  1. 404-to-301.php +70 -0
  2. js-404-admin.php +53 -0
  3. readme.txt +78 -0
  4. screenshot-1.png +0 -0
404-to-301.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ Plugin Name: 404 to 301
5
+ Plugin URI: http://www.joelsays.com/plugins/404-to-301/
6
+ Description: Redirect all 404 pages to any page using 301 redirect.
7
+ Author: Joel James
8
+ Version: 1.0.0
9
+ Author URI: http://www.joelsays.com/about/
10
+ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XUVWY8HUBUXY4
11
+ Copyright (c) 2014 Joel James
12
+ */
13
+ ?>
14
+ <?php
15
+
16
+ add_action('admin_menu', 'js_404_settings_menu');
17
+ if(!function_exists('js_404_settings_menu')) {
18
+ function js_404_settings_menu() {
19
+ add_options_page('404 to 301', '404 to 301', 'administrator', 'admin.php', 'js_404_settings');
20
+ }
21
+ }
22
+
23
+ if(!function_exists('js_404_settings')) {
24
+ function js_404_settings() {
25
+ require_once('js-404-admin.php');
26
+ }
27
+ }
28
+
29
+ if(!function_exists('js_404_redirect')) {
30
+ function js_404_redirect(){
31
+ $type = get_option('type');
32
+ $link = get_option('link');
33
+ if(is_404() && !empty($link) && !empty($type)){
34
+ wp_redirect( $link, $type );
35
+ exit;
36
+ }
37
+ }
38
+ }
39
+ add_action('template_redirect', 'js_404_redirect');
40
+
41
+ register_activation_hook(__FILE__, 'js_404_activate');
42
+ add_action('admin_init', 'js_404_start_redirect');
43
+
44
+ if(!function_exists('js_404_activate')) {
45
+ function js_404_activate() {
46
+ add_option('js_404_activation_redirect', true);
47
+ }
48
+ }
49
+
50
+ if(!function_exists('js_404_start_redirect')) {
51
+ function js_404_start_redirect() {
52
+ if (get_option('js_404_activation_redirect', false)):
53
+ delete_option('js_404_activation_redirect');
54
+ wp_redirect('options-general.php?page=admin.php');
55
+ endif;
56
+ }
57
+ }
58
+
59
+ if(!function_exists('js_404_action_links')) {
60
+ function js_404_action_links($links, $file) {
61
+ $plugin_file = basename(__FILE__);
62
+ if (basename($file) == $plugin_file) :
63
+ $settings_link = '<a href="options-general.php?page=admin.php">Settings</a>';
64
+ array_unshift($links, $settings_link);
65
+ endif;
66
+ return $links;
67
+ }
68
+ }
69
+
70
+ add_filter('plugin_action_links', 'js_404_action_links', 10, 2);
js-404-admin.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Admin setting form
4
+ * Using post values
5
+ */
6
+ if (!current_user_can('manage_options')) {
7
+ wp_die( __('You do not have sufficient permissions to access this page.') );
8
+ }
9
+ if(isset($_POST['oscimp_hidden']) && $_POST['oscimp_hidden'] == 'Y') {
10
+ $type = $_POST['type'];
11
+ update_option('type', $type);
12
+
13
+ $link = $_POST['link'];
14
+ update_option('link', $link);
15
+
16
+ ?>
17
+ <div class="updated"><p><strong><?php _e('Options saved.' ); ?></strong></p></div>
18
+ <?php
19
+ } else {
20
+ $type = get_option('type');
21
+ $username = get_option('link');
22
+ }
23
+ ?>
24
+ <div class="wrap">
25
+ <table width="100%">
26
+ <tr><td width="70%">
27
+ <?php echo "<h3>" . __( '404 to 301', 'oscimp_trdom' ) . " <a href='http://www.joelsays.com/' target='_blank'>Plugin Website</a></h3><h4>More features are coming soon !!</h4>"; ?>
28
+ <hr/>
29
+ <form name="oscimp_form" method="post" action="<?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI']); ?>">
30
+ <input type="hidden" name="oscimp_hidden" value="Y">
31
+ <?php echo "<h4>" . __( 'Redirect Type Settings', 'oscimp_trdom' ) . "</h4>"; ?>
32
+ <p><?php _e("Type of redirect : " ); ?><select name='type' id='type'>
33
+ <option value='301' <?php if($type=='301'){echo 'selected';}?>>301 Permanent</option>
34
+ <option value='302' <?php if($type=='302'){echo 'selected';}?>>302 Temporary</option>
35
+ <option value='307' <?php if($type=='307'){echo 'selected';}?>>307 Temporary</option>
36
+ </select></p>
37
+ <hr />
38
+ <?php echo "<h4>" . __( 'Redirect Page Settings', 'oscimp_trdom' ) . "</h4>"; ?>
39
+ <p><?php _e("Redirect to : " ); ?><input type="text" id="link" name="link" value="<?php echo $link; ?>">
40
+
41
+ <p class="submit">
42
+ <input type="submit" name="Submit" id="submit" value="<?php _e('Update Options', 'oscimp_trdom' ) ?>" />
43
+ </p>
44
+ </form>
45
+ </td><td width="30%" align="center">
46
+ <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XUVWY8HUBUXY4" target="_blank"><img src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif"></a><br/>
47
+ <h4>If you think my plugin is useful, please consider a small donation.</h4>
48
+ <h3>Feel free to <a href="http://www.joelsays.com/contact-me/" target="_blank">Contact Me </a>if you have any doubts or feedback</h4></td>
49
+ </tr></table></div>
50
+ <br/><br><hr/>
51
+ <div align='center'>
52
+ <h4>Main adavtage of this plugin is that 404 errors in your website will not be considered as error pages.<br/>Automatically creates a 301 permanent redirect if a 404 link found to your website.</h4><br/><h3>Check <a href='https://support.google.com/webmasters/answer/93633?hl=en' target='_blank'>Official Google Page</a> to know more about 301 redirect</h3>
53
+ </div>
readme.txt ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === 404 to 301 ===
2
+ Contributors: joelcj91
3
+ Tags: 404, 301, 302, 307, not found, 404 redirect, 404 to 301, 301 redirect
4
+ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XUVWY8HUBUXY4
5
+ Requires at least: 3.0.1
6
+ Tested up to: 3.9.1
7
+ Stable tag: 1.0.0
8
+ License: GPLv2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
+
11
+ Automatically redirect all 404 page errors to any page using 301 redirect for SEO.
12
+
13
+ == Description ==
14
+
15
+ If your website has some 404 error pages then it will affect your SEO badly. Users will leave your site if they get 404 not found error.
16
+
17
+ Using this plugin you can redirect users or Google bot to any other pages using 301 redirect method. That will show them as permanently moved and it is good for SEO.
18
+
19
+ Also you can use 302 and 307 redirect too (Temporary redirect method).
20
+
21
+
22
+ Features of 404 to 301 plugin are,
23
+
24
+ * You can use any link to redirect.
25
+ * No more 404 errors.
26
+ * You can choose which redirect method to be used (301,302,307).
27
+ * Will not irritate your visitors if they type a non existing page url.
28
+ * Light weight.
29
+ * Increase your SEO by telling google that all 404 pages are moved to some other page.
30
+ * Quick <a href="http://www.joelsays.com/contact-me/">Direct Support</a>.
31
+ * Free to use with lifetime updates.
32
+ * More feature coming soon.. (You can suggest also)
33
+
34
+
35
+ == Support ==
36
+
37
+ Current Version: 1.0.0
38
+
39
+ Author: Joel James
40
+ Author URI: http://www.joelsays.com/
41
+
42
+
43
+ == Installation ==
44
+
45
+ 1. Upload `404 to 301` plug-in zip file to the `/wp-content/plugins/` directory
46
+ 2. Activate the plugin through the 'Plugins' menu in WordPress
47
+ 3. You will see a options menu "401 to 301" under settings tab. Go there.
48
+ 4. Choose which type redirection you want (301 recommended).
49
+ 5. Enter a link to where you want your users to get redirected.
50
+ 6. Save it by clicking on "Update Options".
51
+
52
+ == Screenshots ==
53
+
54
+ 1. **Settings** - Settings page of 404 to 301.
55
+
56
+ == Frequently Asked Questions ==
57
+
58
+ = What is the use of 404 to 301? =
59
+
60
+ It will increase your SEO by redirecting using 301.
61
+
62
+
63
+ = What type of redirection is used? =
64
+
65
+ You can choose redirection types like 301,302 and 307.
66
+
67
+
68
+ == Changelog ==
69
+
70
+ = 1.0.0 =
71
+ * Added first version with basic options.
72
+
73
+
74
+
75
+ == Upgrade Notice ==
76
+
77
+ = 1.0.0 =
78
+ Added first version.
screenshot-1.png ADDED
Binary file