I am trying to do url rewriting on linux server through .htaccess file in my root directory.

the content of my .htaccess are

RewriteEngine on
RewriteRule ^test.cleanurl(\/.*)*$ /test.cleanurl.php
RewriteRule ^news(\/.*)*$ /news.php

this is the news.php file


$clean = new CleanURL;
$clean->setRelative('relativeslash'); //relativeslash is variable name
echo 'result query string:<br>';
echo 'id = '.$id . '<br>';
echo 'page = ' . $page . '<br>';

Example Clean URL usage:  <br>
<a href="<?=$relativeslash?><?echo $link=CleanURL::makeClean('news.php?id=120&page=2');?>"><?=$link?></a>

final url is news/120/2

but when i click on the URL I am getting this message.

Not Found
The requested URL /url/news/120/2 was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.


Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/ Server at www.goaseahomes.com Port 80

please help me what is the problem.


You maybe have to add RewriteBase /
I'm not sure it's the exact name but i had a similar error and pointing it to the right root folder worked for me.

This article has been dead for over six months. Start a new discussion instead.