Hi,

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

<?php
require("class.cleanurl.php");

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

?>
<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/5.0.2.2635 Server at www.goaseahomes.com Port 80


please help me what is the problem.

Thanks

Recommended Answers

All 2 Replies

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.