Problem with index.php/archives and index.php/category

Last updated on December 1st, 2010 at 12:34 am

We know that WordPress is most famous blog in the world, and the default link for WordPress is using /archives and /category.

But this make problems to those sites that are not using WordPress, like my site is using Phpwind.

Most of the search engine in the world will search for
example.com/archives/…
example.com/category/…

sometimes search for
example.com/index.php/archives/…
example.com/index.php/category/…

[adrotate banner=”1″]
Many big site will use cache to store the sites that requested by user, and search engine too. So, something wrote appear to my Phpwind site.

It appear
http://forums.perak.org/cn/index.php/archives/images/m/simple/simple/attachment/mini/ae64b982c3.jpg
Sometimes appear
http://forums.perak.org/cn/index.php/category/…

Here is the temporarily solutions for Phpwind, from version 7.3.2 to version 8. If you enable cache.

Edit the file
global.php

put in the code on line 2, after the < ?

$block_uri[0] = 'archives';
$block_uri[1] = 'category';
foreach ($block_uri as $uri) {
if (strpos($_SERVER['REQUEST_URI'], $uri)) {
header('Location: http://forums.perak.org/cn/');
exit;
}
}

Now, all the request to
http://forums.perak.org/cn/index.php/archives/…
http://forums.perak.org/cn/index.php/category/…

Will redirect to http://forums.perak.org/cn/
So, now you just delete all the cache, clean up, then regenerate the cache, all the wrong path won’t be appear anymore.

Update (2010/09/12)

I modified into this to run better.

<?php

$block_uri[0] = 'index.php/';

foreach ($block_uri as $uri) {

if (strpos($_SERVER['REQUEST_URI'], $uri)) {

header('Location: http://forums.perak.org/cn/');

exit;

}

}


[adrotate banner=”2″]
You may add to your index.php.

But I added in global.php

Tags:

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.