phpBB: Redirect broken links after uninstalling an SEO mod
October 9, 2008 on 6:41 pm | In Htaccess, phpBB | No CommentsSEO mods beautify your URLs and make them more spider friendly. But what happens when you uninstall an SEO mod? These SEOed URLs becomes broken and return an error code of ‘404 Not Found’. And these obsolete links can be very harmful for your Search Engine Results Page(SERP) rankings.
I’ve got emails from concerned phpBB forum administrators saying that their position in the SERPs have taken a dip after they had uninstalled their SEO mods and used my phpBB robots.txt duplicate indexing fix. What they need to do is redirect these broken links to the vanilla phpBB links. Using some simple rewrite rules, we can redirect those broken links to their proper place. And we’ll return a ‘301 Permanently Moved’ header so that the threads eventually recover their pagerank and SERP positions.
I’ll be using dcz’s Advanced phpBB3 SEO mod Rewrite as an example. This rewrites the URLs as follows :
viewforum.php?f=XX => any-keywords-fXX.html
viewforum.php?f=XX&start=YY => any-keywords-fXX-YY.html
viewtopic.php?f=XX&t=YY => any-keywords-fXX/topic-title-tYY.html
viewtopic.php?f=XX&t=YY&start=ZZ => any-keywords-fXX/topic-title-tYY-ZZ.html
viewtopic.php?p=XX => postXX.html
memberlist.php?mode=viewprofile&u=XX => memberXX.html
To redirect the broken/obsolete URLs, you need to add the following piece of code to your .htaccess file at the root of the forum :
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule ^[^/\.]+-f([0-9]+)\.html?$ /viewforum.php?f=$1 [R=301,L]
RewriteRule ^[^/\.]+-f([0-9]+)-([0-9]+)\.html?$ /viewforum.php?f=$1&start=$2 [R=301,L]
RewriteRule ^[^/\.]+-f([0-9]+)/[^/\.]+-t([0-9]+)\.html?$ /viewtopic.php?f=$1&t=$2 [R=301,L]
RewriteRule ^[^/\.]+-f([0-9]+)/[^/\.]+-t([0-9]+)-([0-9]+)\.html?$ /viewtopic.php?f=$1&t=$2&start=$3 [R=301,L]
RewriteRule ^post([0-9]+)\.html?$ /viewtopic.php?p=$1 [R=301,L]
RewriteRule ^member([0-9]+)\.html?$ /memberlist.php?mode=viewprofile&u=$1 [R=301,L]
These rules will ensure that those SEOed URLs are 301 redirected to the proper phpBB vanilla URLs, and you’ll eventually recover your pagerank and SERP position.
If you have a problem of you need mod_rewrite rules for another variant of an SEO mod, leave a comment and I’ll help you.
How to avoid restarting your computer after a software install
August 22, 2008 on 7:33 am | In Windows | 1 CommentMany a times, a program you just installed refuses to work without a restart. It’s genuinely annoying to restart your computer again just to use the software. Well, there’s a workaround.
Most of these programs demands a restart because they want the Windows Registry to be re-read. An actual restart is required only for hardware changes, or for system level software like operating system patches or drivers. Most of the other programs should be satisfied by a registry re-read. To force a registry re-read you just have to terminate and restart the Windows Explorer process(explorer.exe).
To do this, press [Ctrl]+[Shift]+[Esc]. The Windows task manager opens up. Select the Processes tab and terminate the ‘explorer.exe’ process by right-clicking on it.
After this we need to restart the explorer.exe process. Go to ‘File>Run’ in Windows task manager itself and type in explorer.exe. The Windows Explorer process will be started and the registry will be re-read in the process.
To make this process simpler, we can take the help of a batch file. Type the following commands into an empty text file and save it as ‘reg_read.bat’.(Notice the .bat at the end)
@echo off
taskkill /f /IM explorer.exe
explorer.exe
This batch file terminates the explorer.exe process and then restarts it.
Now, whenever you need to make windows reread the registry to avoid a restart after you install a new program, double click on ‘reg_read.bat’ and start using the software right away.
Note : It is recommended that you perform an actual restart after installing Windows patches, hotfixes and drivers.
How to change hosts without any downtime, step by step
August 21, 2008 on 9:59 am | In DNS, Web Hosting | No CommentsA common question asked in the various online discussion forums nowadays is “How do I shift/change hosts without any downtime?”. Well, here’s how to do it, step by step.
- Step 1 :
- Step 2 :
- Step 3 :
- Step 4 :
First, add your domain to the control panel of your new host. This way, you’ll ensure that their name servers are updated with your domain’s information, when you point your domain to your new host.
Put your site in read-only mode or maintenance mode. This way, you can ensure that your content do not change while you shift your files. Put up a short message informing visitors of the shifting of hosts. If your site consists of static HTML files, you do not need to worry about this.
Note : Most forums have an option for turning on the maintenance mode. For a Wordpress blog, you might consider using the Maintenance Mode plugin.
Next, backup everything : your databases, files. If you use cPanel, use the Backup feature to backup your files and databases. You might also request your current host to backup your databases and files for you and they should probably do it. You can also manually download all your files using an FTP client and backup your databases with tools like phpMyAdmin.
Now upload the files into your new web host’s webspace. Most hosts provide a way of uploading your files and databases and view your site before the DNS changes propagate. However if your host does not provide you any such a way, you can take help of a little trick.
Note : This would not work unless you have performed the instructions in step 1 of this guide.
Take a note of your new host’s name servers. Let’s say, they are ns1.newhost.com and ns2.newhost.com. Now let’s query those name servers about your domain using the nslookup utility. Go to Start>Run and type in the following :
nslookup yourdomain.com ns1.newhost.com
Replace yourdomain.com with the name of your domain.
The query should output something like this :
Server: ns1.newhost.com
Address: XXX.XXX.XXX.XXX
Name: mydomain.com
Address: 1.2.3.4
Take a note of the IP address of mydomain.com. Now, go to ‘C:\WINDOWS\system32\drivers\etc’ and open the file named ‘hosts’ with a text editor. On a new blank line, add the following lines :
1.2.3.4 yourdomain.com
1.2.3.4 www.yourdomain.com
Replace yourdomain.com and 1.2.3.4 with their real-life equivalents.
Now your domain will be pointed to the IP address of your new host’s server only for you. Now you can upload your files, databases to your new host using yourdomain.com as the URL. After uploading everything, check whether your site is looking as it should and whether it’s generating any errors. If there is any errors or discrepancies, correct them. You should make a minor, but noticable change to your index file at your new host so that you can know if the DNS changes have propagated. After this you should remove the two lines from the ‘hosts’ file that you previously added to it, so that the domain resolves to your old host.
Now it’s time to change the DNS record of your domain. First we have to check if your new host’s name servers have been updated with records of your domain. For this, we need to run an nslookup query. Go to Start>Run and type in :
nslookup yourdomain.com ns1.newhost.com
If the query returns a non-authoritative answer or a “*** UnKnown can’t find yourdomain.com: Server failed” result, then your new host’s name servers haven’t updated yet. Use the same nslookup query to query the name servers again after some time. Repeat this process until it doesn’t return a non-authoritative answer or gives errors for your domain name. Usually, a name server updates itself every 15 minutes, but there may be exceptions. Now it’s safe to change your DNS records. Change your name servers to that of your new host’s OR change your A records to point your domain to your new host’s server’s IP, whichever you wish. The DNS changes will take around 24 to 48 hours to propagate around the world. You’ll know that the changes have propagated when you notice the minor change in your website which you did in Step 4.
Don’t delete your old hosting account yet. Until the DNS changes propagate around the world, people will go to your site hosted at your old host. It’s usually safe to delete your old hosting account after 5 days.
This pretty much concludes this article. If you face any problems while following the steps above, leave a comment and I’ll gladly help you.
The activities of an “in-the-wild” malware
August 20, 2008 on 3:20 am | In General | No Comments
Today, out of boredom, I decided to check the kind of spam I receive in my Gmail inbox. Since all the spam emails had the the same kind of spammy-attractive titles, I decided to check the first one, succulently titled “Video Paris Hilton Nude !”. The email had a conspicuous hyperlink with an H1 anchor text to a file “video-paris-hilton.avi.exe“.(Notice the .exe at the last).
Like an unsuspecting average Joe, I decided to download the file and see what it has in store for me. I scanned the downloaded file with Kaspersky Antivirus and it failed to detect any rogue code in it. So, I decided to run it and see what it does. It’s actions seemed innocuous at first. Double clicking it generated an error :
Feeling kind of dissatisfied, I continued with my work. After a few minutes, suddenly, my wallpaper changed to this :
And I got a warning from KIS that the malware was trying to access the internet. I promptly blocked it.

Now, my first action was to try and change the wallpaper. But I found the ‘Desktop’ and ‘Screensaver’ tabs missing from the Display properties window.
But I’m not the one to easily give up. I did some research and found out that the malware had disabled the Desktop and Screensaver tabs by modifying some registry entries, namely ‘NoDispBackgroundPage’ and ‘NoDispScrSavPage’ from ‘HKEY_CURRENT_USER\Software\Microsoft\Windows\Current Version\Policies\System’. It had modified it’s value from 0 to 1; which had disabled them.
I re-modified the entries to their default values and got back the Desktop and Screensaver tabs in the Display properties window. Then I changed my wallpaper to the previous one.
On the next reboot, I found that the malware copies itself to the ‘C:\Windows\System32\’ as lphcvtmj0ejdn.exe, and creates an autoloading entry in the registry which will run the malware on every reboot. I removed the entry from ”HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\MUICache\” and deleted the file from the ’system32′ folder.
I’ve already sent the malware to Kaspersky Labs for analysis. I’ll update this post when I hear from them.
Update : Response from Kaspersky Labs :
Hello,
video-paris-hilton.avi.exe_ - Trojan-Downloader.Win32.Small.aboa
New malicious software was found in this file. It’s detection will be included in the next update. Thank you for your help.
Please quote all when answering.
–
Best regards, Vyacheslav Zakorzhevsky
Virus analyst, Kaspersky Lab.
e-mail: newvirus@kaspersky.com
http://www.kaspersky.com/
All’s well that ends well!
Making the Woopra analytics code valid xHTML
July 29, 2008 on 11:15 pm | In Web Analytics | 2 CommentsWoopra is a ground-breaking web-analytics service that is seriously better than Google Analytics. However, the default javascript code is flawed, in the sense that it doesn’t validate as xHTML strict.
The default code looks like this :
<script type="text/javascript">
var woopra_id = 'XXXXXXXXXX';
</script>
<script src="http://static.woopra.com/js/woopra.js"></script>
where ‘XXXXXXXXXX’ is the website ID.
To make this valid xHTML, you just need to add type="text/javascript" to the second script tag; so that your code looks like this :
<script type="text/javascript">
var woopra_id = 'XXXXXXXXXX';
</script>
<script src="http://static.woopra.com/js/woopra.js"type="text/javascript"></script>
PS : Those of you who are using the Woopra Wordpress plugin, you don’t need to worry about this. The plugin produces the valid xHTML code by default.
Copyright © 2008 Tech Titbits | Powered by WordPress with Pool theme designed by Borja Fernandez.
Entries and Comments feeds.
Valid XHTML and CSS. ^Top^




