Jump to content

.htaccess (URL rewriting)


itsrahulk

Recommended Posts

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

 

 

Link to comment
https://forums.phpfreaks.com/topic/166047-htaccess-url-rewriting/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.