I created a little web app that allows people to keep content on a page. They can specify the url of the page. Instead of accessing their page like this: http://example.com/stuff?page=their_url I want the url to be like this: http://example.com/stuff/their_url

But I can't figure out how to direct a dynamic url to a Drupal page. I've even tried Apache redirects, but I can't get that working either. I keep getting 404's.

I'm willing to use Apache rewrites to get to the right page.

I'm willing to point to a regular PHP file on the server and bootstrap Drupal, but so far I haven't been able to get that working.

I'm willing to put PHP code into a Drupal page.

I really don't want to write my own Drupal module, so if you want to offer some Drupal code, please tell me where to use it.

I'm willing to use a Drupal 7 module if you know of any.

Thanks a lot!

-- Magmatic

2 Answers 2


i think that you can use the : function drupal_goto

but not sure if that is for your case.

  • Thanks, but this is an external redirect. I want an internal redirect (so the user's browser doesn't see it).
    – Magmatic
    Oct 2, 2014 at 15:59

So after a few hours I finally got something working. This is it:

In my .htaccess file I have a rewrite:

RewriteRule ^fz/(.*) fz.php?page=$1 

Then in my fz.php file I have this:


$_GET["q"] = "filezone";

define('DRUPAL_ROOT', getcwd());

require_once DRUPAL_ROOT . '/includes/bootstrap.inc';


I have a Drupal page that I want to display. It's url is set to be "filezone". In fz.php, it displays this page. And on that page I can get the "page" value with $_GET["page"].

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.