I'm working on a CMS. Imagine a folder named Topics containing an index page named index.php. The mod-rewrite rules in my .htaccess file assign that folder/page the name "topic."

I posted the following code in one of my top pages, to enable me to display and manipulated a page's URL.

PHP Code:
$MyURL = ($_GET['topic']);
$MyURL rtrim($MyURL'/'); 
If I'm viewing a dynamic page, like http://MySite/Topics/Mountains/, for example, then it works fine. But if I'm viewing the home page - http://MySite/Topics/ - then I get an error message, declaring "topic" an undefined index.

It's not a major problem, as everything else still works, and it's a low-level error message that my visitors shouldn't see.

But it kind of bugs me when I'm testing my pages. Anyway, is there some way to fix this "error," or to make the error message disappear? Thanks.