Categories
.htAccess Hacking Internet Tips

How to Block Or Restrict Hackers, Spammers From Visiting your Website

Sometimes the owners(administrators) of new websites gets so many spam comments on their websites.
Many peoples have a bad habit of harming the Websites by hacking spamming etc. If you are facing such type of problem then you can get rid from this by following steps:-

You can get rid from those hackers by blocking there IP (How to know the IP Address) by your web hosts control panel.You have to create .htaaccess file.In this file use these code with IP address

order deny,allow
deny from 203.23.116.11

( 203.23.116.11 is the ip-address of hacker )

Save this setting and you are done.

Now you will not face any more spam comments and your website will be safe from Hacking and unwanted unauthorized access of Hackers.

Categories
.htAccess

CakePHP Tutorial: htaccess Redirecion Rules and modrewrite Tips

If you have a website or blog that was first developed in WordPress and then if you decided to convert it into some other platforms like cakephp, joomla, drupal website or else. Then you may want to install wordpress again in blog folder. Then the structure of your website will be like this

http://www.abc.com/ – inititally a wordpress blog, now a cakephp app

http://www.abc.com/blog/ – becomes the new wordpress blog’s address

Now the issue comes here is

How do I redirect visitors who arrive on the site through bookmarks or not-yet-updated search engine indexes so that they can land on the new wordpress blog address?

CakePHP’s htaccess

First thing you should know about CakePHP and htaccess: there are 3 htaccess files so we need to know which is the correct file to add our redirection rule.

But for this purpose, all we need to do is edit the .htaccess file in the cake app directory, the file which contains the following contents initially:

RewriteBase /
RewriteRule    ^$    webroot/    [L]
RewriteRule    (.*) webroot/$1    [L]

Since the wordpress blog has only a few posts, I added the following redirect rules at the top of the htaccess file. You might have to change the patterns depending on how your wordpress permalinks and tags were setup.

Redirect 301 /post-name-1/ /blog/post-name-1/
Redirect 301 /tag/tech/ /blog/tag/tech/

Final Result

Whenever someone types in or land at http://www.abc.com/post-name-1/, they will be now redirected to http://www.abc.com/blog/post-name-1/

I know this is not a robust and great solution but if you have Sitemap of all your blog posts then you can do the above trick very easily.

See my blog sitemap here www.vaseemansari.com/blog/sitemap.xml and you can see the url of all blog posts, now you need to copy the url and change it in .htaccess file and you are done with the trick. Have fun and feel free to ask me if you have any confusions in mind regarding the above tutorial of htaccess.

Thanks