Joomla!, Wordpress tips for building your site

Joomla!, Wordpress tips for building your site

Syndicate this site using RSS

Permalinks Redirect with Wordpress.

Published on| December 24th, 2009 | No Comment.

Before, I wrote post that "Permalink and Page with WordPress".

In previous post, I wrote setting of an easy permalinks , also setting like a static pages.
If you are able not to change the permalinks , you should not change the permalinks .
Because you will lower the retrieval order by changing the permalinks .

However, if it is necessary to change the permalinks , you should install the plug-in of "Redirect Parmalink".
You will be able to reduce the disadvantage caused because the permalinks is changed by doing so.
This plug-in will work automatically to redirect from the old permalinks to the new permalinks.

Download:ParmaLink Redirect

Let’s try to install.

First ,You should download zip file (Download : ParmaLink Redirect ).
So, you can install (donwload) zip file from plug-in menu-tab ( [Plugins] – [Add New] – [Upload] ) at “Manage Plugin” after Login.
After installation, enable the plug-in.

Let’s try using.

Usage is very simple.

You will notice added menu( like a following image [ParmaLink Redirect]) in Settings tab after you enabled this plugin.
redirect_0

Click [ParmaLink Redirect] in Settings tab.
redirect_1

Here, You should set the permalinks that was set before change at Old Permalink Structures:.
ex.)
/%category%/%post_id%.html

After set, Click [UpdateOptions] for save options.
It is easy.( :D )

This plug-in work very well. But this plugin may occur to a few problems with other plugin.

For example, this plug-in may not work very well with qTransrate plugin.
qTransrate will redirect url like from ‘http://www.example.com/’ to ‘http://www.example.com/en/’.
This matter will occur permanent redirect.
This problem will clear if you edit following code in “ylsy_permalink_redirect.php”.

129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
        if (!$permalink['path']) {
            $permalink['path'] = '/';
        }
        //	add
        $req_path = apply_filters( 'the_permalink',$req_path);
        $permalink['path'] = apply_filters( 'the_permalink',$permalink['path']);
 
        if(($nlen1=strlen($permalink['path'])) != ($nlen2=strlen($req_path))){
            if(abs($nlen1-$nlen2)==1){
                if($nlen1<$nlen2){
                    if(substr($req_path,$nlen2-1)=='/'){
                        $permalink['path'].='/';
                    }
                } else {
                    if(substr($permalink['path'],$nlen1-1)=='/'){
                        $permalink['path']=substr($permalink['path'],0,$nlen1-1);
                    }
                }
            }
        }
 
        if (($req_path != $permalink['path']) || $this->check_hostname()) {
            wp_redirect($new_uri, 301);
        }

You should do filtering like 133 , 134 line.
The method ‘guess_permalink’ of this class might add ‘/’ at the end of URL.
So, you might have to check whether the last character of URL is ‘/’.
If you need to check url end mark, you must write codes like 136-148 lines.


Add to your favorites(bookmarks): はてなブックマークへ追加するdel.icio.usLivedoor ClipYahoo!FC2Nifty ClipPOOKMARK. AirlinesBuzzurl(バザール)Choixnewsing

Trackback URL

After Admin approves this comment, it will be shown.


Comments

Leave a Reply





*