Hello, Welcome to Webune Support Forums. Many of our customer have Linux Dedicated Servers with Apache. One of the mostly asked questions is how you can confirm, verify or check if apache's mod_rewrite module is enabled in the server. By Default, mod_rewrite is not enabled you have to manually enabled it.

how do you enabled mod_rewrite? enabling mod_rewrite is its easy, you just have to check the httpd.conf file and be sure the the mod_rewrite module is not comment out. as you can see, checking is easy.

if you checked your apache configuration file,,now you can check if your server is configured to allow mod_rewrite for your urls here at Webune, we will show you how to check if you have permissions at enable.

on this tutorial we are going to be creating one directory and two files.

FTP to your site and create a directory called: rewrite

2. step 2 is to open your text editor on your computer. since i am using a windows XP computer to write this tutorial i will be using notepad. so open a blank notepad and copy and paste the following code:

PHP CODE:
<?php
### WEBUNE.COM ### Copyright 2006 Webune.com
# PHP SCRIPT TO TEST IS MOD_REWRITE IS WORKING
$FileName = 'webune2542.php';
	if(!strstr($_SERVER['PHP_SELF'],$FileName)){
		echo 'ERROR: You must name this file <b>'.$FileName.'</b> - 
		Or this script will not work<br><br>IF you need more help 
		<a href="http://www.webune.com">Visit Our Forums</a>';
		exit;
	}
?>
<head>
<title>How To Test mod_rewrite in Apache Linux Server</title>
</head>
<body>
<div>
<a href="http://www.webune.com">
<img src="http://www.webune.com/images/headers/default_logo.jpg" border="0" align="Webune Logo">
</a>
</div>
<h1>
<?php
	if($_GET['link']==1){ 
		echo '<span style="color:#F00;">
		Link '.$_GET['link'].': Not using Mod_Rewrite<br />
		URL: '.$FileName.'?link=1</span>';
	}elseif($_GET['link']==2){
		echo '<span style="color:#006600;">Congratulations!! 
		<br />You are using Apache mod_rewrite</span>';
	}else{
		echo '<span style="color:#3366FF;">Check Mod_Rewrite By Webune</span>';
	}
?>
</h1>
<hr />
<div style="width:500px;">
<strong>Click On Each Link Below To Test:</strong><br />
<p><a href="<?php echo $FileName; ?>?link=1">Link 1</a> &nbsp;  &nbsp;[Does Not Use Mod_Rewrite] (URL: ?link=1 )</p>
<p><a href="link2.html">Link 2</a> &nbsp;  &nbsp;[Yes, Uses Mod_Rewrite] (URL: link2.html )</p>
<p><a href="<?php echo $FileName; ?>">Normal</a></p>
<p><strong>How this works::</strong><br>
Both links are for this same page [<?php echo $FileName; ?>], except they both are different. 
link one is without the mod_rewrite and link2 is using mod_rewrite. 
Link1 show the php file, with with mod_rewrite we are mascarading the php file into a html file. 
you can use whatever type of extension you want, you can change it to .htm or .shtml etc... 
all you have to do is to make sure you also chang it in the .htaccess file</p>
<p><strong>Troubleshoot Errors:</strong></p>
<p>1. <strong>Page Not Found?</strong> - 
If when you click on Link 2 and you get page not found. 
Then it appears you dont have Apache's Mod_Rewrite or 
it you may not have it enabled on your server's configuration file.<br>
<a href="http://www.webune.com/forums/how-to-fix-mod-rewrite-500-internal-server-error-on-htaccess-file-apache-t718.html">More Help...</a></p>
<p>2. <strong>500 Internal Server</strong> - 
If you are getting a 500 error, is possible that you made a mistake 
in the .htaccess file, bu sure you put it in the same directory that 
you put this file. Also, be sure that you put the correct file name. <br>
Is should say: <strong><?php echo $FileName; ?></strong><br>
<a href="http://www.webune.com/forums/how-to-fix-mod-rewrite-500-internal-server-error-on-htaccess-file-apache-t718.html">More Help...</a></p>
<p>&lt;&lt;
<a href="http://www.webune.com/forums/how-to-test-check-if-mod-rewrite-is-enabled-t40.html">Go back to Webune forums About This Script</a></p>
<p align="center">How To Test Mod_Rewrite by 
<a href="http://www.webune.com">Webune</a></p>
</div>
</body>
</html>

now save the file as "webune2542.php"

[IMPORTANT: its important that you save it including the quotes if you are also using notepad or else it will add a .txt at the end and we dont need the .txt -Also, Be sure to save it as webune2542.php not another name, or else the script will not work]

after you have saved webune2542.php upload it into the rewrite directory you've just created on your website. then we are going to create a .htaccess file so open a new blank notepad and copy and paste the following apache directives:

.htaccess
RewriteEngine On
RewriteRule ^link([^/]*).html$ webune2542.php?link=$1 [L]


now save this file as ".htaccess"

[NOTE: be sure to include the quotes, or else, notepad will save it as .htaccess.txt ]

now upload .htaccess to the rewrite directory, so now you should have two files in the rewrite directory:

webune2542.php
.htaccess

now open run webune2542.php from your browser by entering the url to webune2542.php. for example:

http://www.example.com/rewrite/webune2542.php

if you have any questions please let us know