Check .htaccess is working or not on server !

Previously I wrote Rewriting tips using .htaccess file for URL rewriting.

Common Usage of .htaccess file :
– Authorization, authentication
– Rewriting URLs
– Blocking
– Directory listing
– MIME types
– Cache Control, and many more.

Here is a test to check that .htaccess or mod_rewrite is enabled on any type of hosting whether shared or dedicated.

Now we want to check for mod_rewrite is enabled or not.

1- First of all create an empty file and name it test.html (or what you want) and upload this file on you hosting server.

2- Create a .htaccess file and put the following code into it. (create htaccess.txt file )

RewriteEngine On
Options +FollowSymLinks
RewriteRule ^test\.html [R=301,L]

Note: On windows machine first create htaccess.txt file, then adds the above code into it, upload on server, after uploading remove the .txt extension.

3- Now run this URL into your browser (replace with your actual domain name).

If it redirects you on then mod_rewrite is working on your server host, if it is not, shows you a blank file means mod_rewrite is not working.

4- If your site runs in some folder then adds the folder name before test.html and uploads the htaccess file in the root folder. Eg

RewriteEngine On
Options +FollowSymLinks
RewriteRule ^foldername/test\.html [R=301,L]

I'm a web developer / PHP programmer. I am also working on custom plugin development of wordpress.